AscEmu
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Player Class Reference

#include <Player.hpp>

Inheritance diagram for Player:
[legend]
Collaboration diagram for Player:
[legend]

Classes

struct  BGEntryData
 
struct  BindData
 
struct  CorpseData
 
struct  SocialFriends
 
struct  SummonData
 

Public Types

typedef std::unordered_map< uint32_t, InstancePlayerBindBoundInstancesMap
 

Public Member Functions

 Player (uint32_t guid)
 
 ~Player ()
 
void Update (unsigned long time_passed)
 
void AddToWorld ()
 
void AddToWorld (WorldMap *pMapMgr)
 
void OnPrePushToWorld () override
 
void OnPushToWorld () override
 
void removeFromWorld ()
 
uint64_t getDuelArbiter () const
 
void setDuelArbiter (uint64_t guid)
 
uint32_t getPlayerFlags () const
 
void setPlayerFlags (uint32_t flags)
 
void addPlayerFlags (uint32_t flags)
 
void removePlayerFlags (uint32_t flags)
 
bool hasPlayerFlags (uint32_t flags) const
 
uint32_t getGuildId () const
 
void setGuildId (uint32_t guildId)
 
uint32_t getGuildRank () const
 
void setGuildRank (uint32_t guildRank)
 
uint32_t getGuildLevel () const
 
void setGuildLevel (uint32_t guildLevel)
 
uint32_t getPlayerBytes () const
 
void setPlayerBytes (uint32_t bytes)
 
uint8_t getSkinColor () const
 
void setSkinColor (uint8_t color)
 
uint8_t getFace () const
 
void setFace (uint8_t face)
 
uint8_t getHairStyle () const
 
void setHairStyle (uint8_t style)
 
uint8_t getHairColor () const
 
void setHairColor (uint8_t color)
 
uint32_t getPlayerBytes2 () const
 
void setPlayerBytes2 (uint32_t bytes2)
 
uint8_t getFacialFeatures () const
 
void setFacialFeatures (uint8_t feature)
 
uint8_t getBankSlots () const
 
void setBankSlots (uint8_t slots)
 
uint8_t getRestState () const
 
void setRestState (uint8_t state)
 
uint32_t getPlayerBytes3 () const
 
void setPlayerBytes3 (uint32_t bytes3)
 
uint8_t getPlayerGender () const
 
void setPlayerGender (uint8_t gender)
 
uint8_t getDrunkValue () const
 
void setDrunkValue (uint8_t value)
 
uint8_t getPvpRank () const
 
void setPvpRank (uint8_t rank)
 
uint8_t getArenaFaction () const
 
void setArenaFaction (uint8_t faction)
 
uint32_t getDuelTeam () const
 
void setDuelTeam (uint32_t team)
 
uint32_t getGuildTimestamp () const
 
void setGuildTimestamp (uint32_t timestamp)
 
uint32_t getQuestLogEntryForSlot (uint8_t slot) const
 
void setQuestLogEntryBySlot (uint8_t slot, uint32_t questEntry)
 
uint32_t getQuestLogStateForSlot (uint8_t slot) const
 
void setQuestLogStateBySlot (uint8_t slot, uint32_t state)
 
uint32_t getQuestLogRequiredMobOrGoForSlot (uint8_t slot) const
 
void setQuestLogRequiredMobOrGoBySlot (uint8_t slot, uint32_t mobOrGoCount)
 
uint32_t getQuestLogExpireTimeForSlot (uint8_t slot) const
 
void setQuestLogExpireTimeBySlot (uint8_t slot, uint32_t expireTime)
 
uint32_t getVisibleItemEntry (uint32_t slot) const
 
void setVisibleItemEntry (uint32_t slot, uint32_t entry)
 
uint32_t getVisibleItemEnchantment (uint32_t slot, uint8_t pos) const
 
void setVisibleItemEnchantment (uint32_t slot, uint8_t pos, uint32_t enchantment)
 
uint64_t getInventorySlotItemGuid (uint8_t slot) const
 
void setInventorySlotItemGuid (uint8_t slot, uint64_t guid)
 
uint64_t getPackSlotItemGuid (uint8_t slot) const
 
void setPackSlotItemGuid (uint8_t slot, uint64_t guid)
 
uint64_t getBankSlotItemGuid (uint8_t slot) const
 
void setBankSlotItemGuid (uint8_t slot, uint64_t guid)
 
uint64_t getBankBagSlotItemGuid (uint8_t slot) const
 
void setBankBagSlotItemGuid (uint8_t slot, uint64_t guid)
 
uint64_t getVendorBuybackSlot (uint8_t slot) const
 
void setVendorBuybackSlot (uint8_t slot, uint64_t guid)
 
uint64_t getVanityPetSlotItemGuid (uint8_t slot) const
 
void setVanityPetSlotItemGuid (uint8_t slot, uint64_t guid)
 
uint64_t getCurrencyTokenSlotItemGuid (uint8_t slot) const
 
void setCurrencyTokenSlotItemGuid (uint8_t slot, uint64_t guid)
 
uint64_t getFarsightGuid () const
 
void setFarsightGuid (uint64_t farsightGuid)
 
uint64_t getKnownCurrencies () const
 
void setKnownCurrencies (uint64_t currencies)
 
uint32_t getXp () const
 
void setXp (uint32_t xp)
 
void addXP (uint32_t xp)
 
uint32_t getNextLevelXp () const
 
void setNextLevelXp (uint32_t xp)
 
uint16_t getSkillInfoId (uint32_t index, uint8_t offset) const
 
uint16_t getSkillInfoStep (uint32_t index, uint8_t offset) const
 
uint16_t getSkillInfoCurrentValue (uint32_t index, uint8_t offset) const
 
uint16_t getSkillInfoMaxValue (uint32_t index, uint8_t offset) const
 
uint16_t getSkillInfoBonusTemporary (uint32_t index, uint8_t offset) const
 
uint16_t getSkillInfoBonusPermanent (uint32_t index, uint8_t offset) const
 
uint32_t getProfessionSkillLine (uint32_t index) const
 
void setSkillInfoId (uint32_t index, uint8_t offset, uint16_t id)
 
void setSkillInfoStep (uint32_t index, uint8_t offset, uint16_t step)
 
void setSkillInfoCurrentValue (uint32_t index, uint8_t offset, uint16_t current)
 
void setSkillInfoMaxValue (uint32_t index, uint8_t offset, uint16_t max)
 
void setSkillInfoBonusTemporary (uint32_t index, uint8_t offset, uint16_t bonus)
 
void setSkillInfoBonusPermanent (uint32_t index, uint8_t offset, uint16_t bonus)
 
void setProfessionSkillLine (uint32_t index, uint32_t value)
 
uint32_t getFreeTalentPoints () const
 
uint32_t getFreePrimaryProfessionPoints () const
 
void setFreePrimaryProfessionPoints (uint32_t points)
 
void modFreePrimaryProfessionPoints (int32_t amount)
 
uint32_t getTrackCreature () const
 
void setTrackCreature (uint32_t id)
 
uint32_t getTrackResource () const
 
void setTrackResource (uint32_t id)
 
float getBlockPercentage () const
 
void setBlockPercentage (float value)
 
float getDodgePercentage () const
 
void setDodgePercentage (float value)
 
float getParryPercentage () const
 
void setParryPercentage (float value)
 
uint32_t getExpertise () const
 
void setExpertise (uint32_t value)
 
void modExpertise (int32_t value)
 
uint32_t getOffHandExpertise () const
 
void setOffHandExpertise (uint32_t value)
 
void modOffHandExpertise (int32_t value)
 
float getMeleeCritPercentage () const
 
void setMeleeCritPercentage (float value)
 
float getRangedCritPercentage () const
 
void setRangedCritPercentage (float value)
 
float getOffHandCritPercentage () const
 
void setOffHandCritPercentage (float value)
 
float getSpellCritPercentage (uint8_t school) const
 
void setSpellCritPercentage (uint8_t school, float value)
 
uint32_t getShieldBlock () const
 
void setShieldBlock (uint32_t value)
 
float getShieldBlockCritPercentage () const
 
void setShieldBlockCritPercentage (float value)
 
uint32_t getExploredZone (uint32_t idx) const
 
void setExploredZone (uint32_t idx, uint32_t data)
 
uint32_t getSelfResurrectSpell () const
 
void setSelfResurrectSpell (uint32_t spell)
 
uint32_t getWatchedFaction () const
 
void setWatchedFaction (uint32_t factionId)
 
float getManaRegeneration () const
 
void setManaRegeneration (float value)
 
float getManaRegenerationWhileCasting () const
 
void setManaRegenerationWhileCasting (float value)
 
uint32_t getMaxLevel () const
 
void setMaxLevel (uint32_t level)
 
float getRuneRegen (uint8_t rune) const
 
void setRuneRegen (uint8_t rune, float regen)
 
uint32_t getRestStateXp () const
 
void setRestStateXp (uint32_t xp)
 
uint64_t getCoinage () const
 
void setCoinage (uint64_t coinage)
 
bool hasEnoughCoinage (uint64_t coinage) const
 
void modCoinage (int64_t coinage)
 
uint32_t getResistanceBuffModPositive (uint8_t type) const
 
void setResistanceBuffModPositive (uint8_t type, uint32_t value)
 
uint32_t getResistanceBuffModNegative (uint8_t type) const
 
void setResistanceBuffModNegative (uint8_t type, uint32_t value)
 
uint32_t getModDamageDonePositive (uint16_t school) const
 
void setModDamageDonePositive (uint16_t school, uint32_t value)
 
void modModDamageDonePositive (uint16_t school, int32_t value)
 
uint32_t getModDamageDoneNegative (uint16_t school) const
 
void setModDamageDoneNegative (uint16_t school, uint32_t value)
 
void modModDamageDoneNegative (uint16_t school, int32_t value)
 
float getModDamageDonePct (uint8_t shool) const
 
void setModDamageDonePct (float damagePct, uint8_t shool)
 
uint32_t getModHealingDone () const
 
void setModHealingDone (uint32_t value)
 
void modModHealingDone (int32_t value)
 
uint32_t getModTargetResistance () const
 
void setModTargetResistance (uint32_t value)
 
void modModTargetResistance (int32_t value)
 
uint32_t getModTargetPhysicalResistance () const
 
void setModTargetPhysicalResistance (uint32_t value)
 
void modModTargetPhysicalResistance (int32_t value)
 
uint32_t getPlayerFieldBytes () const
 
void setPlayerFieldBytes (uint32_t bytes)
 
uint8_t getPlayerFieldBytesMiscFlag () const
 
void setPlayerFieldBytesMiscFlag (uint8_t miscFlag)
 
void addPlayerFieldBytesMiscFlag (uint8_t miscFlag)
 
void removePlayerFieldBytesMiscFlag (uint8_t miscFlag)
 
uint8_t getEnabledActionBars () const
 
void setEnabledActionBars (uint8_t actionBarId)
 
uint32_t getBuybackPriceSlot (uint8_t slot) const
 
void setBuybackPriceSlot (uint8_t slot, uint32_t price)
 
uint32_t getBuybackTimestampSlot (uint8_t slot) const
 
void setBuybackTimestampSlot (uint8_t slot, uint32_t timestamp)
 
uint32_t getLifetimeHonorableKills () const
 
void setLifetimeHonorableKills (uint32_t kills)
 
uint32_t getPlayerFieldBytes2 () const
 
void setPlayerFieldBytes2 (uint32_t bytes)
 
uint8_t getAuraVision () const
 
void setAuraVision (uint8_t auraVision)
 
void addAuraVision (uint8_t auraVision)
 
void removeAuraVision (uint8_t auraVision)
 
uint32_t getCombatRating (uint8_t combatRating) const
 
void setCombatRating (uint8_t combatRating, uint32_t value)
 
void modCombatRating (uint8_t combatRating, int32_t value)
 
uint32_t getNoReagentCost (uint8_t index) const
 
void setNoReagentCost (uint8_t index, uint32_t value)
 
uint32_t getGlyphSlot (uint16_t slot) const
 
void setGlyphSlot (uint16_t slot, uint32_t glyph)
 
uint32_t getGlyph (uint16_t slot) const
 
void setGlyph (uint16_t slot, uint32_t glyph)
 
uint32_t getGlyphsEnabled () const
 
void setGlyphsEnabled (uint32_t glyphs)
 
void sendForceMovePacket (UnitSpeedType speed_type, float speed)
 
void sendMoveSetSpeedPaket (UnitSpeedType speed_type, float speed)
 
void resendSpeed ()
 
bool isMoving () const
 
uint32_t getMountSpellId () const
 
void setMountSpellId (uint32_t id)
 
bool isOnVehicle () const
 
uint32_t getMountVehicleId () const
 
void setMountVehicleId (uint32_t id)
 
void handleAuraInterruptForMovementFlags (MovementInfo const &movement_info)
 
bool isInCity () const
 
void handleBreathing (MovementInfo const &movement_info, WorldSession *session)
 
void initialiseNoseLevel ()
 
void handleKnockback (Object *caster, float horizontal, float vertical) override
 
bool teleport (const LocationVector &vec, WorldMap *map)
 
void eventTeleport (uint32_t mapId, LocationVector position, uint32_t instanceId=0)
 
bool safeTeleport (uint32_t mapId, uint32_t instanceId, const LocationVector &vec)
 
void safeTeleport (WorldMap *mgr, const LocationVector &vec)
 
void setTransferStatus (uint8_t status)
 
uint8_t getTransferStatus () const
 
bool isTransferPending () const
 
uint32_t getTeleportState () const
 
void sendTeleportPacket (LocationVector position)
 
void sendTeleportAckPacket (LocationVector position)
 
void onWorldPortAck ()
 
void eventPortToGm (Player *gmPlayer)
 
void indoorCheckUpdate (uint32_t time)
 
time_t getFallDisabledUntil () const
 
void setFallDisabledUntil (time_t time)
 
void setMapEntryPoint (uint32_t mapId)
 
void setPhase (uint8_t command=PHASE_SET, uint32_t newPhase=1) override
 
void zoneUpdate (uint32_t zoneId)
 
void forceZoneUpdate ()
 
bool hasAreaExplored (WDB::Structures::AreaTableEntry const *)
 
bool hasOverlayUncovered (uint32_t overlayId)
 
void eventExploration ()
 
void ejectFromInstance ()
 
bool exitInstance ()
 
bool create (CharCreate &charCreateContent)
 
WDB::Structures::ChrRacesEntry constgetDbcRaceEntry ()
 
WDB::Structures::ChrClassesEntry constgetDbcClassEntry ()
 
utf8_string getName () const
 
void setName (std::string name)
 
uint32_t getLoginFlag () const
 
void setLoginFlag (uint32_t flag)
 
void setInitialDisplayIds (uint8_t gender, uint8_t race)
 
void applyLevelInfo (uint32_t newLevel)
 
virtual bool isClassMage () const
 
virtual bool isClassDeathKnight () const
 
virtual bool isClassPriest () const
 
virtual bool isClassRogue () const
 
virtual bool isClassShaman () const
 
virtual bool isClassHunter () const
 
virtual bool isClassWarlock () const
 
virtual bool isClassWarrior () const
 
virtual bool isClassPaladin () const
 
virtual bool isClassMonk () const
 
virtual bool isClassDruid () const
 
PlayerTeam getTeam () const
 
PlayerTeam getBgTeam () const
 
void setTeam (uint32_t team)
 
void setBgTeam (uint32_t team)
 
uint32_t getInitialTeam () const
 
void resetTeam ()
 
bool isTeamHorde () const
 
bool isTeamAlliance () const
 
UnitgetUnitOwner () override
 
Unit constgetUnitOwner () const override
 
UnitgetUnitOwnerOrSelf () override
 
Unit constgetUnitOwnerOrSelf () const override
 
PlayergetPlayerOwner () override
 
Player constgetPlayerOwner () const override
 
PlayergetPlayerOwnerOrSelf () override
 
Player constgetPlayerOwnerOrSelf () const override
 
void toggleAfk ()
 
void toggleDnd ()
 
uint32_tgetPlayedTime ()
 
CachedCharacterInfogetPlayerInfo () const
 
void sendInitialLogonPackets ()
 
WorldSessiongetSession () const
 
void setSession (WorldSession *session)
 
void removePendingPlayer ()
 
void softDisconnect ()
 
void outPacket (uint16_t opcode, uint16_t length, const void *data) override
 
void sendPacket (WorldPacket *packet) override
 
void outPacketToSet (uint16_t opcode, uint16_t length, const void *data, bool sendToSelf) override
 
void sendMessageToSet (WorldPacket *data, bool sendToSelf, bool sendToOwnTeam=false) override
 
void sendDelayedPacket (WorldPacket *data, bool deleteDataOnSend)
 
void processPendingUpdates ()
 
bool compressAndSendUpdateBuffer (uint32_t size, const uint8_t *update_buffer)
 
uint32_t buildCreateUpdateBlockForPlayer (ByteBuffer *data, Player *target) override
 This includes any nested objects we have, inventory for example.
 
void copyAndSendDelayedPacket (WorldPacket *data)
 
void setEnteringToWorld ()
 
CreaturegetCreatureWhenICanInteract (WoWGuid const &guid, uint32_t npcflagmask)
 
UpdateManagergetUpdateMgr ()
 
void addVisibleObject (uint64_t guid)
 
void removeVisibleObject (uint64_t guid)
 
bool isVisibleObject (uint64_t guid)
 
void removeIfVisiblePushOutOfRange (uint64_t guid)
 
void setInitialPlayerData ()
 
void regeneratePlayerPowers (uint16_t diff)
 
void resetHolyPowerTimer ()
 
void updateManaRegeneration (bool initialUpdate=false)
 
void updateRageRegeneration (bool initialUpdate=false)
 
void updateRunicPowerRegeneration (bool initialUpdate=false)
 
float_t calculateHealthRegenerationValue (bool inCombat) const
 
bool loadSpells (QueryResult *result)
 
bool loadSkills (QueryResult *result)
 
bool loadReputations (QueryResult *result)
 
bool hasSpell (uint32_t spellId) const
 
bool hasDeletedSpell (uint32_t spellId) const
 
void addSpell (uint32_t spellId, uint16_t fromSkill=0)
 
void addDeletedSpell (uint32_t spellId)
 
bool removeSpell (uint32_t spellId, bool moveToDeleted)
 
bool removeDeletedSpell (uint32_t spellId)
 
SpellSet constgetSpellSet () const
 
SpellSet constgetDeletedSpellSet () const
 
void sendSmsgInitialSpells ()
 
void sendPreventSchoolCast (uint32_t spellSchool, uint32_t timeMs)
 
void resetSpells ()
 
void addShapeShiftSpell (uint32_t spellId)
 
void removeShapeShiftSpell (uint32_t spellId)
 
SpellSet constgetShapeshiftSpells () const
 
void sendAvailSpells (WDB::Structures::SpellShapeshiftFormEntry const *shapeshiftFormEntry, bool active)
 
bool isInFeralForm ()
 
bool isInDisallowedMountForm () const
 
void updateAutoRepeatSpell ()
 
bool canUseFlyingMountHere ()
 
bool canDualWield2H () const
 
void setDualWield2H (bool enable)
 
bool isSpellFitByClassAndRace (uint32_t spell_id) const
 
uint32_t getHealthFromSpell ()
 
void setHealthFromSpell (uint32_t value)
 
uint32_t getManaFromSpell ()
 
void setManaFromSpell (uint32_t value)
 
void calcResistance (uint8_t type)
 
float getResistMCrit ()
 
void setResistMCrit (float newvalue)
 
float getResistRCrit ()
 
void setResistRCrit (float newvalue)
 
bool hasSpellOnCooldown (SpellInfo const *spellInfo)
 
bool hasSpellGlobalCooldown (SpellInfo const *spellInfo)
 
void addSpellCooldown (SpellInfo const *spellInfo, Item const *itemCaster, Spell *castingSpell=nullptr, int32_t cooldownTime=0)
 
void addGlobalCooldown (SpellInfo const *spellInfo, Spell *castingSpell, const bool sendPacket=false)
 
void sendSpellCooldownPacket (SpellInfo const *spellInfo, const uint32_t duration, const bool isGcd)
 
void clearCooldownForSpell (uint32_t spellId)
 
void clearGlobalCooldown ()
 
void resetAllCooldowns ()
 
void setLastPotion (uint32_t itemId)
 
void cooldownAddItem (ItemProperties const *itemProp, uint32_t spellIndex)
 
bool cooldownCanCast (ItemProperties const *itemProp, uint32_t spellIndex)
 
void updatePotionCooldown ()
 
bool hasSpellWithAuraNameAndBasePoints (uint32_t auraName, uint32_t basePoints)
 
void advanceAllSkills (uint16_t amount=1)
 
void advanceSkillLine (uint16_t skillLine, uint16_t amount=1)
 
void addSkillLine (uint16_t skillLine, uint16_t currentValue, uint16_t maxValue, bool noSpellLearning=false, bool initializeProfession=false)
 
bool hasSkillLine (uint16_t skillLine, bool strict=false) const
 
uint16_t getSkillLineCurrent (uint16_t skillLine, bool includeBonus=true) const
 
uint16_t getSkillLineMax (uint16_t skillLine) const
 
void learnInitialSkills ()
 
void learnSkillSpells (uint16_t skillLine, uint16_t currentValue)
 
void modifySkillBonus (uint16_t skillLine, int16_t amount, bool permanentBonus)
 
void modifySkillMaximum (uint16_t skillLine, uint16_t maxValue)
 
void removeSkillLine (uint16_t skillLine)
 
void removeSkillSpells (uint16_t skillLine)
 
void removeAllSkills ()
 
void updateSkillMaximumValues ()
 
float getSkillUpChance (uint16_t id)
 
void setInitialPlayerProfessions ()
 
uint32_t getArmorProficiency () const
 
void addArmorProficiency (uint32_t proficiency)
 
void removeArmorProficiency (uint32_t proficiency)
 
uint32_t getWeaponProficiency () const
 
void addWeaponProficiency (uint32_t proficiency)
 
void removeWeaponProficiency (uint32_t proficiency)
 
void applyItemProficienciesFromSpell (SpellInfo const *spellInfo, bool apply)
 
uint64_t getComboPointTarget () const
 
int8_t getComboPoints () const
 
void addComboPoints (uint64_t targetGuid, int8_t points)
 
void updateComboPoints ()
 
void clearComboPoints ()
 
void learnTalent (uint32_t talentId, uint32_t talentRank)
 
void resetTalents ()
 
void resetAllTalents ()
 
void setTalentPoints (uint32_t talentPoints, bool forBothSpecs=true)
 
void addTalentPoints (uint32_t talentPoints, bool forBothSpecs=true)
 
void setInitialTalentPoints (bool talentsResetted=false)
 
uint32_t getTalentPointsFromQuests () const
 
void setTalentPointsFromQuests (uint32_t talentPoints)
 
void smsg_TalentsInfo (bool SendPetTalents)
 
void activateTalentSpec (uint8_t specId)
 
uint32_t getTalentResetsCount () const
 
void setTalentResetsCount (uint32_t value)
 
uint32_t calcTalentResetCost (uint32_t resetnum) const
 
uint32_t getTutorialValueById (uint8_t id)
 
void setTutorialValueForId (uint8_t id, uint32_t value)
 
void loadTutorials ()
 
void saveTutorials ()
 
void setActionButton (uint8_t button, uint32_t action, uint8_t type, uint8_t misc)
 
void sendActionBars (uint8_t action)
 
void sendAuctionCommandResult (Auction *auction, uint32_t Action, uint32_t ErrorCode, uint32_t bidError=0)
 
PlayergetTradeTarget () const
 
TradeDatagetTradeData () const
 
void cancelTrade (bool sendToSelfAlso, bool silently=false)
 
void sendReportToGmMessage (std::string playerName, std::string damageLog)
 
void broadcastMessage (const char *Format,...)
 
void sendAreaTriggerMessage (const char *message,...)
 
void disableSummoning (bool disable)
 
bool isSummoningDisabled () const
 
void disableAppearing (bool disable)
 
bool isAppearingDisabled () const
 
bool isBanned () const
 
void setBanned (uint32_t timestamp=4, std::string Reason="")
 
void unsetBanned ()
 
std::string getBanReason () const
 
GameObjectgetSelectedGo () const
 
void setSelectedGo (uint64_t guid)
 
void kickFromServer (uint32_t delay=0)
 
void eventKickFromServer ()
 
void sendSummonRequest (uint32_t requesterId, uint32_t zoneId, uint32_t mapId, uint32_t instanceId, const LocationVector &position)
 
void setAFKReason (std::string reason)
 
std::string getAFKReason () const
 
void addToGMTargetList (uint32_t guid)
 
void removeFromGMTargetList (uint32_t guid)
 
bool isOnGMTargetList (uint32_t guid) const
 
void unEquipOffHandIfRequired ()
 
bool hasOffHandWeapon () const
 
bool hasItem (uint32_t itemId, uint32_t amount=1, bool checkBankAlso=false) const
 
ItemInterfacegetItemInterface () const
 
void removeTempItemEnchantsOnArena ()
 
void addGarbageItem (std::unique_ptr< Item > item)
 
void applyItemMods (Item *item, int16_t slot, bool apply, bool justBrokedown=false, bool skipStatApply=false)
 
InstanceDifficulty::Difficulties getDifficulty (bool isRaid) const
 
void setDungeonDifficulty (uint8_t diff)
 
uint8_t getDungeonDifficulty ()
 
void setRaidDifficulty (uint8_t diff)
 
uint8_t getRaidDifficulty ()
 
void die (Unit *unitAttacker, uint32_t damage, uint32_t spellId) override
 
void setCorpseData (LocationVector position, int32_t instanceId)
 
LocationVector getCorpseLocation () const
 
int32_t getCorpseInstanceId () const
 
void setAllowedToCreateCorpse (bool allowed)
 
bool isAllowedToCreateCorpse () const
 
void createCorpse ()
 
void spawnCorpseBody ()
 
void spawnCorpseBones ()
 
void repopRequest ()
 
void repopAtGraveyard (float ox, float oy, float oz, uint32_t mapId)
 
void resurrect ()
 
void buildRepop ()
 
void calcDeathDurabilityLoss (double percent)
 
void setResurrecterGuid (uint64_t guid)
 
void setResurrectHealth (uint32_t health)
 
void setResurrectMana (uint32_t mana)
 
void setResurrectInstanceId (uint32_t id)
 
void setResurrectMapId (uint32_t id)
 
void setResurrectPosition (LocationVector position)
 
uint64_t getAreaSpiritHealerGuid () const
 
void setAreaSpiritHealerGuid (uint64_t guid)
 
void setFullHealthMana ()
 
void setResurrect ()
 
void setBindPoint (float x, float y, float z, float o, uint32_t mapId, uint32_t zoneId)
 
LocationVector getBindPosition () const
 
uint32_t getBindMapId () const
 
uint32_t getBindZoneId () const
 
void setBGEntryPoint (float x, float y, float z, float o, uint32_t mapId, int32_t instanceId)
 
LocationVector getBGEntryPosition () const
 
uint32_t getBGEntryMapId () const
 
int32_t getBGEntryInstanceId () const
 
void unsetCharter (uint8_t charterType)
 
Charter constgetCharter (uint8_t charterType)
 
bool canSignCharter (Charter const *charter, Player *requester)
 
void initialiseCharters ()
 
void setInvitedByGuildId (uint32_t GuildId)
 
uint32_t getInvitedByGuildId () const
 
GuildgetGuild () const
 
bool isInGuild ()
 
uint32_t getGuildRankFromDB ()
 
void setGroupInviterId (uint32_t inviterId)
 
uint32_t getGroupInviterId () const
 
bool isAlreadyInvitedToGroup () const
 
bool isInGroup () const
 
GroupgetGroup ()
 
bool isGroupLeader () const
 
int8_t getSubGroupSlot () const
 
uint32_t getGroupUpdateFlags () const
 
void setGroupUpdateFlags (uint32_t flags)
 
void addGroupUpdateFlag (uint32_t flag)
 
uint16_t getGroupStatus ()
 
void sendUpdateToOutOfRangeGroupMembers ()
 
void eventGroupFullUpdate ()
 
bool isSendOnlyRaidgroupSet () const
 
void setSendOnlyRaidgroup (bool set)
 
LocationVector getLastGroupPosition () const
 
void joinedChannel (Channel *channel)
 
void leftChannel (Channel *channel)
 
void updateChannels ()
 
void removeAllChannels ()
 
void setArenaTeam (uint8_t type, ArenaTeam *arenaTeam)
 
ArenaTeamgetArenaTeam (uint8_t type)
 
bool isInArenaTeam (uint8_t type) const
 
void initialiseArenaTeam ()
 
void addArenaPoints (uint32_t arenaPoints, bool sendUpdate)
 
uint32_t getArenaPoints () const
 
void removeArenaPoints (uint32_t arenaPoints, bool sendUpdate)
 
void updateArenaPoints ()
 
void setInviteArenaTeamId (uint32_t id)
 
uint32_t getInviteArenaTeamId () const
 
void addHonor (uint32_t honorPoints, bool sendUpdate)
 
uint32_t getHonor () const
 
void removeHonor (uint32_t honorPoints, bool sendUpdate)
 
void updateHonor ()
 
void rolloverHonor ()
 
uint32_t getHonorToday () const
 
uint32_t getHonorYesterday () const
 
uint32_t getHonorless () const
 
void incrementHonorless ()
 
void decrementHonorless ()
 
void incrementKills (uint32_t count=0)
 
uint32_t getKillsToday () const
 
uint32_t getKillsLifetime () const
 
uint32_t getKillsYesterday () const
 
void resetPvPTimer ()
 
void stopPvPTimer ()
 
void setupPvPOnLogin ()
 
void updatePvPArea ()
 
void togglePvP ()
 
void updatePvPCurrencies ()
 
bool hasPvPTitle (RankTitles title)
 
void setKnownPvPTitle (RankTitles title, bool set)
 
BattlegroundgetBattleground () const
 
void setBattleground (Battleground *bg)
 
BattlegroundgetPendingBattleground () const
 
void setPendingBattleground (Battleground *bg)
 
bool isQueuedForBg () const
 
void setIsQueuedForBg (bool set)
 
bool hasQueuedBgInstanceId () const
 
uint32_t getQueuedBgInstanceId () const
 
void setQueuedBgInstanceId (uint32_t id)
 
bool isQueuedForRbg () const
 
void setIsQueuedForRbg (bool value)
 
void removeFromBgQueue ()
 
bool hasWonRbgToday () const
 
void setHasWonRbgToday (bool value)
 
void setBgQueueType (uint32_t type)
 
uint32_t getBgQueueType () const
 
bool hasBgFlag () const
 
void setHasBgFlag (bool set)
 
void setRoles (uint8_t role)
 
uint8_t retRoles () const
 
void fillRandomBattlegroundReward (bool wonBattleground, uint32_t &honorPoints, uint32_t &arenaPoints)
 
void applyRandomBattlegroundReward (bool wonBattleground)
 
uint32_t getLevelGrouping ()
 
void acceptQuest (uint64_t guid, uint32_t quest_id)
 
QuestLogEntrycreateQuestLogInSlot (QuestProperties const *questProperties, uint8_t slotId)
 
bool hasAnyQuestInQuestSlot () const
 
bool hasQuestInQuestLog (uint32_t questId) const
 
uint8_t getFreeQuestSlot () const
 
QuestLogEntrygetQuestLogByQuestId (uint32_t questId) const
 
QuestLogEntrygetQuestLogBySlotId (uint32_t slotId) const
 
void addQuestIdToFinishedDailies (uint32_t questId)
 
std::set< uint32_tgetFinishedDailies () const
 
bool hasQuestInFinishedDailies (uint32_t questId) const
 
void resetFinishedDailies ()
 
bool hasTimedQuestInQuestSlot () const
 
void eventTimedQuestExpire (uint32_t questId)
 
uint32_t getQuestSharerByDbId () const
 
void setQuestSharerDbId (uint32_t id)
 
void addQuestToRemove (uint32_t questId)
 
void addQuestToFinished (uint32_t questId)
 
bool hasQuestFinished (uint32_t questId) const
 
void areaExploredQuestEvent (uint32_t questId)
 
void clearQuest (uint32_t questId)
 
bool hasQuestForItem (uint32_t itemId) const
 
void addQuestSpell (uint32_t spellId)
 
bool hasQuestSpell (uint32_t spellId)
 
void removeQuestSpell (uint32_t spellId)
 
void addQuestMob (uint32_t entry)
 
bool hasQuestMob (uint32_t entry)
 
void removeQuestMob (uint32_t entry)
 
void addQuestKill (uint32_t questId, uint8_t reqId, uint32_t delay=0)
 
void updateNearbyQuestGameObjects ()
 
std::set< uint32_tgetFinishedQuests () const
 
void loadFriendList ()
 
void loadFriendedByOthersList ()
 
void loadIgnoreList ()
 
void addToFriendList (std::string name, std::string note)
 
void removeFromFriendList (uint32_t guid)
 
void addNoteToFriend (uint32_t guid, std::string note)
 
bool isFriended (uint32_t guid) const
 
void sendFriendStatus (bool comesOnline)
 
void sendFriendLists (uint32_t flags)
 
void addToIgnoreList (std::string name)
 
void removeFromIgnoreList (uint32_t guid)
 
bool isIgnored (uint32_t guid) const
 
void speedCheatDelay (uint32_t delay)
 
void speedCheatReset ()
 
bool activateTaxiPathTo (std::vector< uint32_t > const &nodes, Creature *npc=nullptr, uint32_t spellid=0)
 
bool activateTaxiPathTo (uint32_t taxi_path_id, uint32_t spellid=0)
 
bool activateTaxiPathTo (uint32_t taxi_path_id, Creature *npc)
 
void cleanupAfterTaxiFlight ()
 
void continueTaxiFlight () const
 
void sendTaxiNodeStatusMultiple ()
 
bool isInFlight () const
 
bool isOnTaxi () const
 
void initTaxiNodesForLevel ()
 
TaxiPathgetTaxiData () const
 
const uint64_tgetLootGuid () const
 
void setLootGuid (const uint64_t &guid)
 
void sendLoot (uint64_t guid, uint8_t loot_type, uint32_t mapId)
 
void sendLootUpdate (Object *object)
 
void sendLooter (Creature *creature)
 
ItemstoreNewLootItem (uint8_t slot, Loot *loot)
 
ItemstoreItem (LootItem const *lootItem)
 
bool isLootableOnCorpse () const
 
void setLootableOnCorpse (bool lootable)
 
void setFactionStanding (uint32_t faction, int32_t value)
 
int32_t getFactionStanding (uint32_t faction)
 
int32_t getBaseFactionStanding (uint32_t faction)
 
void modFactionStanding (uint32_t faction, int32_t value)
 
Standing getFactionStandingRank (uint32_t faction)
 
void applyForcedReaction (uint32_t faction_id, Standing rank, bool apply)
 
Standing constgetForcedReputationRank (WDB::Structures::FactionTemplateEntry const *factionTemplateEntry) const
 
void setFactionAtWar (uint32_t faction, bool set)
 
bool isFactionAtWar (WDB::Structures::FactionEntry const *factionEntry) const
 
bool isHostileBasedOnReputation (WDB::Structures::FactionEntry const *factionEntry)
 
void updateInrangeSetsBasedOnReputation ()
 
void onKillUnitReputation (Unit *unit, bool innerLoop)
 
void onTalkReputation (WDB::Structures::FactionEntry const *factionEntry)
 
void setFactionInactive (uint32_t faction, bool set)
 
bool addNewFaction (WDB::Structures::FactionEntry const *factionEntry, int32_t standing, bool base)
 
void onModStanding (WDB::Structures::FactionEntry const *factionEntry, FactionReputation *reputation)
 
uint32_t getExaltedCount ()
 
void sendSmsgInitialFactions ()
 
void initialiseReputation ()
 
uint32_t getInitialFactionId ()
 
int32_t getPctReputationMod () const
 
void setPctReputationMod (int32_t value)
 
void setChampioningFaction (uint32_t factionId)
 
uint16_t getServersideDrunkValue () const
 
void setServersideDrunkValue (uint16_t newDrunkValue, uint32_t itemId=0)
 
void handleSobering ()
 
PlayergetDuelPlayer () const
 
void requestDuel (Player *target)
 
void testDuelBoundary ()
 
void endDuel (uint8_t condition)
 
void cancelDuel ()
 
void handleDuelCountdown ()
 
void setDuelStatus (uint8_t status)
 
uint8_t getDuelStatus () const
 
void setDuelState (uint8_t state)
 
uint8_t getDuelState () const
 
void giveXp (uint32_t xp, const uint64_t &guid, bool allowBonus)
 
void sendLogXpGainPacket (uint64_t guid, uint32_t normalXp, uint32_t restedXp, bool type)
 
void toggleXpGain ()
 
bool canGainXp () const
 
uint32_t subtractRestXp (uint32_t amount)
 
void addCalculatedRestXp (uint32_t seconds)
 
void applyPlayerRestState (bool apply)
 
void updateRestState ()
 
PetCache constgetPetCache (uint8_t petId) const
 
PetCachegetModifiablePetCache (uint8_t petId) const
 
PetCacheMap constgetPetCacheMap () const
 
std::map< uint8_t, uint8_t > constgetPetCachedSlotMap () const
 
void addPetCache (std::unique_ptr< PetCache > petCache, uint8_t index)
 
void removePetCache (uint8_t petId)
 
uint8_t getPetCount () const
 
uint8_t getFreePetNumber ()
 
std::optional< uint8_tgetPetIdFromSlot (uint8_t slot) const
 
bool hasPetInSlot (uint8_t slot) const
 
std::optional< uint8_tfindFreeActivePetSlot () const
 
std::optional< uint8_tfindFreeStablePetSlot () const
 
bool tryPutPetToSlot (uint8_t petId, uint8_t newSlot, bool sendErrors=true)
 
void spawnPet (uint8_t petId)
 
void summonTemporarilyUnsummonedPet ()
 
void unSummonPetTemporarily ()
 
bool isPetRequiringTemporaryUnsummon () const
 
void setTemporarilyUnsummonedPetsOffline ()
 
void setLastBattlegroundPetId (uint8_t petId)
 
uint8_t getLastBattlegroundPetId () const
 
void setLastBattlegroundPetSpell (uint32_t petSpell)
 
uint32_t getLastBattlegroundPetSpell () const
 
void setStableSlotCount (uint8_t count)
 
uint8_t getStableSlotCount () const
 
void eventSummonPet (Pet *summonPet)
 
void eventDismissPet ()
 
ObjectgetSummonedObject () const
 
void setSummonedObject (Object *summonedObject)
 
bool isGMFlagSet () const
 
void sendMovie (uint32_t movieId)
 
void logIntoBattleground ()
 
bool logOntoTransport ()
 
void setLoginPosition ()
 
void setPlayerInfoIfNeeded ()
 
void setGuildAndGroupInfo ()
 
void sendCinematicOnFirstLogin ()
 
void sendTalentResetConfirmPacket ()
 
void sendPetUnlearnConfirmPacket ()
 
void sendDungeonDifficultyPacket ()
 
void sendRaidDifficultyPacket ()
 
void sendResetFailedNotify (uint32_t mapid)
 
void sendInstanceDifficultyPacket (uint8_t difficulty)
 
void sendNewDrunkStatePacket (uint32_t state, uint32_t itemId)
 
void sendSetProficiencyPacket (uint8_t itemClass, uint32_t proficiency)
 
void sendPartyKillLogPacket (uint64_t killedGuid)
 
void sendDestroyObjectPacket (uint64_t destroyedGuid)
 
void sendEquipmentSetUseResultPacket (uint8_t result)
 
void sendTotemCreatedPacket (uint8_t slot, uint64_t guid, uint32_t duration, uint32_t spellId)
 
void sendPetTameFailure (uint8_t result) const
 
void sendGossipPoiPacket (float posX, float posY, uint32_t icon, uint32_t flags, uint32_t data, std::string name)
 
void sendPoiById (uint32_t id)
 
void sendStopMirrorTimerPacket (MirrorTimerTypes type)
 
void sendMeetingStoneSetQueuePacket (uint32_t dungeonId, uint8_t status)
 
void sendPlayObjectSoundPacket (uint64_t objectGuid, uint32_t soundId)
 
void sendPlaySoundPacket (uint32_t soundId)
 
void sendExploreExperiencePacket (uint32_t areaId, uint32_t experience)
 
void sendSpellCooldownEventPacket (uint32_t spellId)
 
void sendSpellModifierPacket (uint8_t spellType, std::vector< std::pair< uint8_t, float > > modValues, bool isPct)
 
void sendLoginVerifyWorldPacket (uint32_t mapId, float posX, float posY, float posZ, float orientation)
 
void sendMountResultPacket (uint32_t result)
 
void sendDismountResultPacket (uint32_t result)
 
void sendCastFailedPacket (uint32_t spellId, uint8_t errorMessage, uint8_t multiCast, uint32_t extra1, uint32_t extra2=0)
 
void sendLevelupInfoPacket (uint32_t level, uint32_t hp, uint32_t mana, uint32_t stat0, uint32_t stat1, uint32_t stat2, uint32_t stat3, uint32_t stat4)
 
void sendItemPushResultPacket (bool created, bool recieved, bool sendtoset, uint8_t destbagslot, uint32_t destslot, uint32_t count, uint32_t entry, uint32_t suffix, uint32_t randomprop, uint32_t stack)
 
void sendClientControlPacket (Unit *target, uint8_t allowMove)
 
void sendGuildMotd ()
 
void sendEquipmentSetList ()
 
void sendEquipmentSetSaved (uint32_t setId, uint32_t setGuid)
 
void sendEmptyPetSpellList ()
 
void sendInitialWorldstates ()
 
bool isPvpFlagSet () const override
 
void setPvpFlag () override
 
void removePvpFlag () override
 
bool isFfaPvpFlagSet () const override
 
void setFfaPvpFlag () override
 
void removeFfaPvpFlag () override
 
bool isSanctuaryFlagSet () const override
 
void setSanctuaryFlag () override
 
void removeSanctuaryFlag () override
 
void sendPvpCredit (uint32_t honor, uint64_t victimGuid, uint32_t victimRank)
 
void sendRaidGroupOnly (uint32_t timeInMs, uint32_t type)
 
void setVisibleItemFields (uint32_t slot, Item *item)
 
void applyReforgeEnchantment (Item *item, bool apply)
 
bool isAtGroupRewardDistance (Object *pRewardSource)
 
void tagUnit (Object *object)
 
void sendUpdateDataToSet (ByteBuffer *groupBuf, ByteBuffer *nonGroupBuf, bool sendToSelf)
 
void sendWorldStateUpdate (uint32_t worldState, uint32_t value)
 
bool canBuyAt (MySQLStructure::VendorRestrictions const *vendor)
 
bool canTrainAt (Trainer const *trainer)
 
void sendCinematicCamera (uint32_t id)
 
void setMover (Unit *target)
 
void resetTimeSync ()
 
void sendTimeSync ()
 
void buildFlagUpdateForNonGroupSet (uint32_t index, uint32_t flag)
 
void modifyBonuses (uint32_t type, int32_t val, bool apply)
 
void calcExpertise ()
 
void calculateDamage () override
 
int32_t GetDamageDoneMod (uint16_t school) override
 
float GetDamageDonePctMod (uint16_t school) override
 
uint32_t getMainMeleeDamage (uint32_t attackPowerOverride)
 
void setTalentHearthOfWildPCT (int value)
 
void eventTalentHearthOfWildChange (bool apply)
 
void saveToDB (bool newCharacter)
 
void saveAuras (std::stringstream &)
 
bool loadFromDB (uint32_t guid)
 
void loadFromDBProc (QueryResultVector &results)
 
bool saveSpells (bool newCharacter, QueryBuffer *buf)
 
bool loadDeletedSpells (QueryResult *result)
 
bool saveDeletedSpells (bool newCharacter, QueryBuffer *buf)
 
bool saveReputations (bool newCharacter, QueryBuffer *buf)
 
bool saveSkills (bool newCharacter, QueryBuffer *buf)
 
PlayerSpecgetActiveSpec ()
 
void eventAttackStart ()
 
void eventAttackStop ()
 
void eventDeath ()
 
void addToInRangeObjects (Object *object) override
 
void onRemoveInRangeObject (Object *object) override
 
void clearInRangeSets () override
 
void updateAttackSpeed ()
 
float getDefenseChance (uint32_t opLevel)
 
float getDodgeChance ()
 
float getBlockChance ()
 
float getParryChance ()
 
void updateChances ()
 
void updateStats ()
 
uint32_t getBlockDamageReduction ()
 
void applyFeralAttackPower (bool apply, Item *item=NULL)
 
float getSpellCritFromSpell ()
 
float getHitFromSpell ()
 
void setSpellCritFromSpell (float value)
 
void setHitFromSpell (float value)
 
void eventCannibalize (uint32_t amount)
 
void calcStat (uint8_t t)
 
float calcRating (PlayerCombatRating t)
 
void regenerateHealth (bool inCombat)
 
uint64_t getMisdirectionTarget ()
 
void setMisdirectionTarget (uint64_t PlayerGUID)
 
void addItemsToWorld ()
 
void removeItemsFromWorld ()
 
void updateKnownCurrencies (uint32_t itemId, bool apply)
 
void eventCharmAttack ()
 
void clearCooldownsOnLine (uint32_t skillLine, uint32_t calledFrom)
 
void sendMirrorTimer (MirrorTimerTypes mirrorType, uint32_t max, uint32_t current, int32_t regen)
 
void updateChanceFields ()
 
uint32_t getMaxPersonalRating ()
 
void loadBoundInstances ()
 
InstancePlayerBindgetBoundInstance (uint32_t mapId, InstanceDifficulty::Difficulties difficulty, bool withExpired=false)
 
BoundInstancesMapgetBoundInstances (InstanceDifficulty::Difficulties difficulty)
 
InstanceSavedgetInstanceSave (uint32_t mapId, bool isRaid)
 
void unbindInstance (uint32_t mapid, InstanceDifficulty::Difficulties difficulty, bool unload=false)
 
void unbindInstance (BoundInstancesMap::iterator &itr, InstanceDifficulty::Difficulties difficulty, bool unload=false)
 
InstancePlayerBindbindToInstance (InstanceSaved *save, bool permanent, BindExtensionState extendState=EXTEND_STATE_NORMAL, bool load=false)
 
void bindToInstance ()
 
void setPendingBind (uint32_t instanceId, uint32_t bindTimer)
 
bool hasPendingBind () const
 
void sendRaidInfo ()
 
void sendSavedInstances ()
 
void resetInstances (uint8_t method, bool isRaid)
 
void sendResetInstanceFailed (uint32_t reason, uint32_t MapId)
 
void sendInstanceResetWarning (uint32_t mapid, InstanceDifficulty::Difficulties difficulty, uint32_t time, bool welcome)
 
void loadInstanceTimeRestrictions ()
 
bool checkInstanceCount (uint32_t instanceId) const
 
void addInstanceEnterTime (uint32_t instanceId, time_t enterTime)
 
void saveInstanceTimeRestrictions ()
 
void _Relocate (uint32_t mapid, const LocationVector &v, bool sendpending, bool force_new_world, uint32_t instance_id)
 
void addSummonSpell (uint32_t entry, uint32_t spellId)
 
void removeSummonSpell (uint32_t entry, uint32_t spellId)
 
std::set< uint32_t > * getSummonSpells (uint32_t spellId)
 
void handleSpellLoot (uint32_t itemId)
 
void completeLoading ()
 
bool isAttacking ()
 
void displayDataStateList ()
 
void displayTimerList ()
 
void displayCreatureSetForEntry (uint32_t _creatureEntry)
 
uint32_t checkDamageLimits (uint32_t damage, uint32_t spellId)
 
void loadFieldsFromString (const char *string, uint16_t firstField, uint32_t fieldsNum)
 
void avengingWrath ()
 
- Public Member Functions inherited from Unit
virtual ~Unit ()
 
void Update (unsigned long time_passed)
 
virtual void RemoveFromWorld (bool free_guid)
 Remove object from world.
 
uint64_t getCharmGuid () const
 
void setCharmGuid (uint64_t guid)
 
uint64_t getSummonGuid () const
 
void setSummonGuid (uint64_t guid)
 
uint64_t getCharmedByGuid () const
 
void setCharmedByGuid (uint64_t guid)
 
bool isCharmed () const
 
uint64_t getSummonedByGuid () const
 
void setSummonedByGuid (uint64_t guid)
 
uint64_t getCreatedByGuid () const
 
void setCreatedByGuid (uint64_t guid)
 
uint64_t getTargetGuid () const
 
void setTargetGuid (uint64_t guid)
 
uint64_t getTransGuid ()
 
uint64_t getChannelObjectGuid () const
 
void setChannelObjectGuid (uint64_t guid)
 
uint32_t getChannelSpellId () const
 
void setChannelSpellId (uint32_t spell_id)
 
uint32_t getBytes0 () const
 
void setBytes0 (uint32_t bytes)
 
uint8_t getBytes0ByOffset (uint32_t offset) const
 
void setBytes0ForOffset (uint32_t offset, uint8_t value)
 
uint8_t getRace () const
 
void setRace (uint8_t race)
 
uint32_t getRaceMask () const
 
uint8_t getClass () const
 
void setClass (uint8_t class_)
 
uint32_t getClassMask () const
 
uint8_t getGender () const
 
void setGender (uint8_t gender)
 
PowerType getPowerType () const
 
void setPowerType (uint8_t powerType)
 
uint32_t getHealth () const
 
void setHealth (uint32_t health)
 
void modHealth (int32_t health)
 
void setFullHealth ()
 
void setHealthPct (uint32_t val)
 
uint32_t getPower (PowerType type) const
 
void setPower (PowerType type, uint32_t value, bool sendPacket=true, bool skipObjectUpdate=false)
 
void modPower (PowerType type, int32_t value)
 
uint32_t getMaxHealth () const
 
void setMaxHealth (uint32_t maxHealth)
 
void modMaxHealth (int32_t maxHealth)
 
uint32_t getMaxPower (PowerType type) const
 
void setMaxPower (PowerType type, uint32_t value)
 
void modMaxPower (PowerType type, int32_t value)
 
float getPowerRegeneration (PowerType type) const
 
void setPowerRegeneration (PowerType type, float value)
 
float getPowerRegenerationWhileInterrupted (PowerType type) const
 
void setPowerRegenerationWhileInterrupted (PowerType type, float value)
 
uint32_t getLevel () const
 
void setLevel (uint32_t level)
 
uint32_t getFactionTemplate () const
 
void setFactionTemplate (uint32_t id)
 
void setFaction (uint32_t factionId)
 
uint32_t getVirtualItemSlotId (uint8_t slot) const
 
void setVirtualItemSlotId (uint8_t slot, uint32_t item_id)
 
uint32_t getUnitFlags () const
 
void setUnitFlags (uint32_t unitFlags)
 
void addUnitFlags (uint32_t unitFlags)
 
void removeUnitFlags (uint32_t unitFlags)
 
bool hasUnitFlags (uint32_t unitFlags) const
 
bool isInCombat () const
 
bool isInCombatWith (Unit const *victim) const
 
virtual bool canSwim ()
 
uint32_t getAuraState () const
 
void setAuraState (uint32_t state)
 
void addAuraState (uint32_t state)
 
void removeAuraState (uint32_t state)
 
uint32_t getBaseAttackTime (uint8_t slot) const
 
void setBaseAttackTime (uint8_t slot, uint32_t time)
 
void modBaseAttackTime (uint8_t slot, int32_t modTime)
 
float getBoundingRadius () const
 
void setBoundingRadius (float radius)
 
float getCombatReach () const
 
void setCombatReach (float radius)
 
uint32_t getDisplayId () const
 
void setDisplayId (uint32_t id)
 
void resetDisplayId ()
 
uint32_t getNativeDisplayId () const
 
void setNativeDisplayId (uint32_t id)
 
uint32_t getMountDisplayId () const
 
void setMountDisplayId (uint32_t id)
 
float getMinDamage () const
 
void setMinDamage (float damage)
 
float getMaxDamage () const
 
void setMaxDamage (float damage)
 
float getMinOffhandDamage () const
 
void setMinOffhandDamage (float damage)
 
float getMaxOffhandDamage () const
 
void setMaxOffhandDamage (float damage)
 
uint32_t getBytes1 () const
 
void setBytes1 (uint32_t bytes)
 
uint8_t getBytes1ByOffset (uint32_t offset) const
 
void setBytes1ForOffset (uint32_t offset, uint8_t value)
 
uint8_t getStandState () const
 
void setStandState (uint8_t standState)
 
uint8_t getStandStateFlags () const
 
void setStandStateFlags (uint8_t standStateFlags)
 
void addStandStateFlags (uint8_t standStateFlags)
 
void removeStandStateFlags (uint8_t standStateFlags)
 
uint32_t getPetNumber () const
 
void setPetNumber (uint32_t timestamp)
 
uint32_t getPetNameTimestamp () const
 
void setPetNameTimestamp (uint32_t timestamp)
 
uint32_t getPetExperience () const
 
void setPetExperience (uint32_t experience)
 
uint32_t getPetNextLevelExperience () const
 
void setPetNextLevelExperience (uint32_t experience)
 
float getModCastSpeed () const
 
void setModCastSpeed (float modifier)
 
void modModCastSpeed (float modifier)
 
uint32_t getCreatedBySpellId () const
 
void setCreatedBySpellId (uint32_t id)
 
uint64_t getNpcFlags () const
 
void setNpcFlags (uint64_t npcFlags)
 
void addNpcFlags (uint64_t npcFlags)
 
void removeNpcFlags (uint64_t npcFlags)
 
uint32_t getEmoteState () const
 
void setEmoteState (uint32_t id)
 
uint32_t getStat (uint8_t stat) const
 
void setStat (uint8_t stat, uint32_t value)
 
uint32_t getResistance (uint8_t type) const
 
void setResistance (uint8_t type, uint32_t value)
 
uint32_t getBaseMana () const
 
void setBaseMana (uint32_t baseMana)
 
uint32_t getBaseHealth () const
 
void setBaseHealth (uint32_t baseHealth)
 
uint32_t getBytes2 () const
 
void setBytes2 (uint32_t bytes)
 
uint8_t getBytes2ByOffset (uint32_t offset) const
 
void setBytes2ForOffset (uint32_t offset, uint8_t value)
 
uint8_t getSheathType () const
 
void setSheathType (uint8_t sheathType)
 
uint8_t getPositiveAuraLimit () const
 
void setPositiveAuraLimit (uint8_t limit)
 
uint8_t getPetFlags () const
 
void setPetFlags (uint8_t petFlags)
 
void addPetFlags (uint8_t petFlags)
 
void removePetFlags (uint8_t petFlags)
 
uint8_t getShapeShiftForm () const
 
void setShapeShiftForm (uint8_t shapeShiftForm)
 
uint32_t getShapeShiftMask () const
 
uint32_t getAttackPower () const
 
void setAttackPower (uint32_t value)
 
int32_t getRangedAttackPower () const
 
void setRangedAttackPower (int32_t power)
 
float getMinRangedDamage () const
 
void setMinRangedDamage (float damage)
 
float getMaxRangedDamage () const
 
void setMaxRangedDamage (float damage)
 
uint32_t getPowerCostModifier (uint16_t school) const
 
void setPowerCostModifier (uint16_t school, uint32_t modifier)
 
void modPowerCostModifier (uint16_t school, int32_t modifier)
 
float getPowerCostMultiplier (uint16_t school) const
 
void setPowerCostMultiplier (uint16_t school, float multiplier)
 
void modPowerCostMultiplier (uint16_t school, float multiplier)
 
int32_t getAttackPowerMods () const
 
void setAttackPowerMods (int32_t modifier)
 
void modAttackPowerMods (int32_t modifier)
 
float getAttackPowerMultiplier () const
 
void setAttackPowerMultiplier (float multiplier)
 
void modAttackPowerMultiplier (float multiplier)
 
int32_t getRangedAttackPowerMods () const
 
void setRangedAttackPowerMods (int32_t modifier)
 
void modRangedAttackPowerMods (int32_t modifier)
 
float getRangedAttackPowerMultiplier () const
 
void setRangedAttackPowerMultiplier (float multiplier)
 
void modRangedAttackPowerMultiplier (float multiplier)
 
float getHoverHeight () const
 
void setHoverHeight (float height)
 
void setLocationWithoutUpdate (LocationVector &location)
 
bool isWithinCombatRange (Unit *obj, float dist2compare)
 
bool isWithinMeleeRange (Unit *obj)
 
bool isWithinMeleeRangeAt (LocationVector const &pos, Unit *obj)
 
float getMeleeRange (Unit *target)
 
bool isInInstance () const
 
virtual bool isInWater () const
 
bool isUnderWater () const
 
bool isInAccessiblePlaceFor (Creature *c) const
 
CombatHandlergetCombatHandler ()
 
CombatHandler constgetCombatHandler () const
 
int32_t getCalculatedAttackPower () const
 
int32_t getCalculatedRangedAttackPower () const
 
bool canReachWithAttack (Unit *unitTarget)
 
bool canBeginCombat (Unit *target)
 
MovementInfogetMovementInfo ()
 
uint32_t getUnitMovementFlags () const
 
void setUnitMovementFlags (uint32_t f)
 
void addUnitMovementFlag (uint32_t f)
 
void removeUnitMovementFlag (uint32_t f)
 
bool hasUnitMovementFlag (uint32_t f) const
 
uint16_t getExtraUnitMovementFlags () const
 
void addExtraUnitMovementFlag (uint16_t f2)
 
bool hasExtraUnitMovementFlag (uint16_t f2) const
 
bool isRooted () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsFlying () const
 
bool IsFalling () const
 
bool isWalking () const
 
bool isHovering () const
 
void setInFront (Object const *target)
 
void setFacingTo (float const ori, bool force=true)
 
void setFacingToObject (Object *object, bool force=true)
 
void setMoveWaterWalk ()
 
void setMoveLandWalk ()
 
void setMoveFeatherFall ()
 
void setMoveNormalFall ()
 
void setMoveHover (bool set_hover)
 
void setMoveCanFly (bool set_fly)
 
void setMoveRoot (bool set_root)
 
void setMoveSwim (bool set_swim)
 
void setMoveDisableGravity (bool disable_gravity)
 
void setMoveWalk (bool set_walk)
 
void setFacing (float newo)
 
void handleFall (MovementInfo const &movementInfo)
 
UnitSpeedInfo constgetSpeedInfo () const
 
float getSpeedRate (UnitSpeedType type, bool current) const
 
void resetCurrentSpeeds ()
 
UnitSpeedType getFastestSpeedType () const
 
void propagateSpeedChange ()
 
void setSpeedRate (UnitSpeedType mtype, float rate, bool current)
 
bool getSpeedDecrease ()
 
void updateSpeed ()
 
void followerAdded (AbstractFollower *f)
 
void followerRemoved (AbstractFollower *f)
 
void removeAllFollowers ()
 
virtual float getFollowAngle () const
 
MovementManagergetMovementManager ()
 
MovementManager constgetMovementManager () const
 
virtual bool canFly ()
 
void stopMoving ()
 
void pauseMovement (uint32_t timer=0, uint8_t slot=0, bool forced=true)
 
void resumeMovement (uint32_t timer=0, uint8_t slot=0)
 
void sendMoveSplinePaket (UnitSpeedType speed_type)
 
void disableSpline ()
 
bool isSplineEnabled () const
 
void jumpTo (float speedXY, float speedZ, bool forward=true, Optional< LocationVector > dest={})
 
void jumpTo (Object *obj, float speedZ, bool withOrientation=false)
 
virtual MovementGeneratorType getDefaultMovementType () const
 
AIInterfacegetAIInterface () const
 
void setAItoUse (bool value)
 
bool isAIEnabled ()
 
void addUnitStateFlag (uint32_t state_flag)
 
bool hasUnitStateFlag (uint32_t state_flag) const
 
void removeUnitStateFlag (uint32_t state_flag)
 
uint32_t getUnitStateFlags ()
 
bool isInEvadeMode () const
 
void setControlled (bool apply, UnitStates state)
 
void applyControlStatesIfNeeded ()
 
void playSpellVisual (uint32_t visual_id, uint32_t type)
 
void applyDiminishingReturnTimer (uint32_t *duration, SpellInfo const *spell)
 
void removeDiminishingReturnTimer (SpellInfo const *spell)
 
bool canDualWield () const
 
void setDualWield (bool enable)
 
SpellCastResult castSpell (uint64_t targetGuid, uint32_t spellId, bool triggered=false)
 
SpellCastResult castSpell (Unit *target, uint32_t spellId, bool triggered=false)
 
SpellCastResult castSpell (uint64_t targetGuid, SpellInfo const *spellInfo, bool triggered=false)
 
SpellCastResult castSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
SpellCastResult castSpell (uint64_t targetGuid, uint32_t spellId, SpellForcedBasePoints forcedBasepoints, bool triggered=false)
 
SpellCastResult castSpell (Unit *target, uint32_t spellId, SpellForcedBasePoints forcedBasePoints, bool triggered=false)
 
SpellCastResult castSpell (Unit *target, SpellInfo const *spellInfo, SpellForcedBasePoints forcedBasePoints, int32_t spellCharges, bool triggered=false)
 
SpellCastResult castSpell (SpellCastTargets targets, uint32_t spellId, bool triggered=false)
 
SpellCastResult castSpell (SpellCastTargets targets, SpellInfo const *spellInfo, bool triggered=false)
 
SpellCastResult castSpellLoc (const LocationVector location, uint32_t spellId, bool triggered=false)
 
SpellCastResult castSpellLoc (const LocationVector location, SpellInfo const *spellInfo, bool triggered=false)
 
void eventCastSpell (Unit *target, SpellInfo const *spellInfo)
 
SpellCastResult castSpell (uint64_t targetGuid, SpellInfo const *spellInfo, SpellForcedBasePoints forcedBasepoints, bool triggered)
 
SpellCastResult castSpell (Unit *target, SpellInfo const *spellInfo, SpellForcedBasePoints forcedBasepoints, bool triggered)
 
SpellProcaddProcTriggerSpell (uint32_t spellId, uint32_t originalSpellId, uint64_t casterGuid, uint32_t procChance, SpellProcFlags procFlags, SpellExtraProcFlags exProcFlags, uint32_t const *spellFamilyMask, uint32_t const *procClassMask=nullptr, Aura *createdByAura=nullptr, Object *obj=nullptr)
 
SpellProcaddProcTriggerSpell (SpellInfo const *spellInfo, uint64_t casterGuid, Aura *createdByAura=nullptr, uint32_t const *procClassMask=nullptr, Object *obj=nullptr)
 
SpellProcaddProcTriggerSpell (SpellInfo const *spellInfo, Aura *createdByAura, uint64_t casterGuid, uint32_t const *procClassMask=nullptr, Object *obj=nullptr)
 
SpellProcaddProcTriggerSpell (SpellInfo const *spellInfo, SpellInfo const *originalSpellInfo, uint64_t casterGuid, uint32_t procChance, uint32_t procFlags, uint32_t const *procClassMask=nullptr, Aura *createdByAura=nullptr, Object *obj=nullptr)
 
SpellProcaddProcTriggerSpell (SpellInfo const *spellInfo, SpellInfo const *originalSpellInfo, uint64_t casterGuid, uint32_t procChance, SpellProcFlags procFlags, SpellExtraProcFlags exProcFlags, uint32_t const *spellFamilyMask, uint32_t const *procClassMask=nullptr, Aura *createdByAura=nullptr, Object *obj=nullptr)
 
SpellProcgetProcTriggerSpell (uint32_t spellId, uint64_t casterGuid) const
 
void removeProcTriggerSpell (uint32_t spellId, uint64_t casterGuid=0, uint64_t misc=0)
 
void clearProcCooldowns ()
 
float_t applySpellDamageBonus (SpellInfo const *spellInfo, int32_t baseDmg, float_t effectPctModifier=1.0f, bool isPeriodic=false, Spell *castingSpell=nullptr, Aura *aur=nullptr)
 
float_t applySpellHealingBonus (SpellInfo const *spellInfo, int32_t baseHeal, float_t effectPctModifier=1.0f, bool isPeriodic=false, Spell *castingSpell=nullptr, Aura *aur=nullptr)
 
float_t getCriticalChanceForDamageSpell (Spell *spell, Aura *aura, Unit *target)
 
float_t getCriticalChanceForHealSpell (Spell *spell, Aura *aura, Unit *target)
 
bool isCriticalDamageForSpell (Object *target, Spell *spell)
 
bool isCriticalHealForSpell (Object *target, Spell *spell)
 
float_t getCriticalDamageBonusForSpell (float_t damage, Unit *target, Spell *spell, Aura *aura)
 
float_t getCriticalHealBonusForSpell (float_t heal, Spell *spell, Aura *aura)
 
void sendSpellNonMeleeDamageLog (Object *caster, Object *target, SpellInfo const *spellInfo, uint32_t damage, uint32_t absorbedDamage, uint32_t resistedDamage, uint32_t blockedDamage, uint32_t overKill, bool isPeriodicDamage, bool isCriticalHit)
 
void sendSpellHealLog (Object *caster, Object *target, uint32_t spellId, uint32_t healAmount, bool isCritical, uint32_t overHeal, uint32_t absorbedHeal)
 
void sendSpellOrDamageImmune (uint64_t casterGuid, Unit *target, uint32_t spellId)
 
void sendAttackerStateUpdate (const WoWGuid &attackerGuid, const WoWGuid &victimGuid, HitStatus hitStatus, uint32_t damage, uint32_t overKill, DamageInfo damageInfo, uint32_t absorbedDamage, VisualState visualState, uint32_t blockedDamage, uint32_t rageGain)
 
void addSpellModifier (AuraEffectModifier const *aurEff, bool apply)
 
template<typename T >
void applySpellModifiers (SpellModifierType modType, T *value, SpellInfo const *spellInfo, Spell *castingSpell=nullptr, Aura *castingAura=nullptr)
 
template<typename T >
void getTotalSpellModifiers (SpellModifierType modType, T baseValue, int32_t *flatMod, int32_t *pctMod, SpellInfo const *spellInfo, Spell *castingSpell=nullptr, Aura *castingAura=nullptr, bool checkOnly=false)
 
void addSpellImmunity (SpellImmunityMask immunityMask, bool apply)
 
uint32_t getSpellImmunity () const
 
bool hasSpellImmunity (SpellImmunityMask immunityMask) const
 
void addAura (std::unique_ptr< Aura > aur)
 
uint8_t findVisualSlotForAura (Aura const *aur) const
 
AuragetAuraWithId (uint32_t spell_id) const
 
AuragetAuraWithId (uint32_t const *auraId) const
 
AuragetAuraWithIdForGuid (uint32_t const *auraId, uint64_t guid) const
 
AuragetAuraWithIdForGuid (uint32_t spell_id, uint64_t guid) const
 
AuragetAuraWithAuraEffect (AuraEffect aura_effect) const
 
AuragetAuraWithAuraEffectForGuid (AuraEffect aura_effect, uint64_t guid) const
 
AuragetAuraWithVisualSlot (uint8_t visualSlot) const
 
AuragetAuraWithAuraSlot (uint16_t auraSlot) const
 
int32_t getTotalIntDamageForAuraEffect (AuraEffect aura_effect) const
 
int32_t getTotalIntDamageForAuraEffectByMiscValue (AuraEffect aura_effect, int32_t miscValue) const
 
float_t getTotalFloatDamageForAuraEffect (AuraEffect aura_effect) const
 
float_t getTotalFloatDamageForAuraEffectByMiscValue (AuraEffect aura_effect, int32_t miscValue) const
 
float_t getTotalPctMultiplierForAuraEffect (AuraEffect aura_effect) const
 
float_t getTotalPctMultiplierForAuraEffectByMiscValue (AuraEffect aura_effect, int32_t miscValue) const
 
bool hasAurasWithId (uint32_t auraId) const
 
bool hasAurasWithId (uint32_t const *auraId) const
 
bool hasAurasWithIdForGuid (uint32_t auraId, uint64_t guid) const
 
bool hasAurasWithIdForGuid (uint32_t const *auraId, uint64_t guid) const
 
bool hasAuraWithAuraEffect (AuraEffect type) const
 
bool hasAuraWithAuraEffectForGuid (AuraEffect type, uint64_t guid) const
 
bool hasAuraWithMechanic (SpellMechanic mechanic) const
 
bool hasAuraWithSpellType (SpellTypes type, uint64_t casterGuid=0, uint32_t skipSpellId=0) const
 
bool hasAuraState (AuraState state, SpellInfo const *spellInfo=nullptr, Unit const *caster=nullptr) const
 
void addAuraStateAndAuras (AuraState state)
 
void removeAuraStateAndAuras (AuraState state)
 
uint32_t getAuraCountForId (uint32_t auraId) const
 
uint32_t getAuraCountForEffect (AuraEffect aura_effect) const
 
uint32_t getAuraCountWithDispelType (DispelType type, uint64_t casterGuid=0) const
 
void removeAllAuras ()
 
void removeAllAurasById (uint32_t auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
void removeAllAurasById (uint32_t const *auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
void eventRemoveAura (uint32_t spellId)
 
void removeAllAurasByIdForGuid (uint32_t auraId, uint64_t guid, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
void removeAllAurasByAuraInterruptFlag (uint32_t auraInterruptFlag, uint32_t skipSpellId=0)
 
void removeAllAurasByAuraEffect (AuraEffect effect, uint32_t skipSpell=0, bool removeOnlyEffect=false, uint64_t casterGuid=0, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
void removeAllAurasBySpellMechanic (SpellMechanic mechanic, bool negativeOnly=true)
 
void removeAllAurasBySpellMechanic (SpellMechanic const *mechanic, bool negativeOnly=true)
 
void removeAllAurasBySpellType (SpellTypes type, uint64_t casterGuid=0, uint32_t skipSpellId=0)
 
void removeAllAurasBySchoolMask (SchoolMask schoolMask, bool negativeOnly=true, bool isImmune=false)
 
void removeAllNegativeAuras ()
 
void removeAllPositiveAuras ()
 
void removeAllNonPersistentAuras ()
 
void removeAuraByItemGuid (uint32_t auraId, uint64_t itemguid)
 
uint32_t removeAllAurasByIdReturnCount (uint32_t auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
 
uint64_t getSingleTargetGuidForAura (uint32_t spellId)
 
uint64_t getSingleTargetGuidForAura (uint32_t const *spellIds, uint32_t *index)
 
void setSingleTargetGuidForAura (uint32_t spellId, uint64_t guid)
 
void removeSingleTargetGuidForAura (uint32_t spellId)
 
void clearAllAreaAuraTargets ()
 
void removeAllAreaAurasCastedByOther ()
 
uint32_t getTransformAura () const
 
void setTransformAura (uint32_t auraId)
 
void sendAuraUpdate (Aura *aur, bool remove)
 
void sendFullAuraUpdate ()
 
bool sendPeriodicAuraLog (const WoWGuid &casterGuid, const WoWGuid &targetGuid, SpellInfo const *spellInfo, uint32_t amount, uint32_t overKillOrOverHeal, uint32_t absorbed, uint32_t resisted, AuraEffect auraEffect, bool isCritical, uint32_t miscValue=0, float gainMultiplier=0.0f)
 
AuraArray constgetAuraList () const
 
AuraEffectList constgetAuraEffectList (AuraEffect effect) const
 
VisualAuraArray constgetVisualAuraList () const
 
bool isPoisoned ()
 
bool isDazed () const
 
bool canSee (Object *const obj)
 
int32_t getStealthLevel (StealthFlag flag) const
 
int32_t getStealthDetection (StealthFlag flag) const
 
void modStealthLevel (StealthFlag flag, const int32_t amount)
 
void modStealthDetection (StealthFlag flag, const int32_t amount)
 
bool isStealthed () const
 
int32_t getInvisibilityLevel (InvisibilityFlag flag) const
 
int32_t getInvisibilityDetection (InvisibilityFlag flag) const
 
void modInvisibilityLevel (InvisibilityFlag flag, const int32_t amount)
 
void modInvisibilityDetection (InvisibilityFlag flag, const int32_t amount)
 
bool isInvisible () const
 
void setVisible (const bool visible)
 
void updateVisibility ()
 
void regenerateHealthAndPowers (uint16_t timePassed)
 
void regeneratePower (PowerType type, uint16_t timePassed)
 
void interruptHealthRegeneration (uint32_t timeInMS)
 
bool isHealthRegenerationInterrupted () const
 
void energize (Unit *target, uint32_t spellId, uint32_t amount, PowerType type, bool sendPacket=true)
 
void sendSpellEnergizeLog (Unit *target, uint32_t spellId, uint32_t amount, PowerType type)
 
uint8_t getHealthPct () const
 
uint8_t getPctFromMaxHealth (uint8_t pct) const
 
uint8_t getPowerPct (PowerType powerType) const
 
void sendPowerUpdate (bool self)
 
void updateEnergyRegeneration (bool initialUpdate=false)
 
void updateFocusRegeneration (bool initialUpdate=false)
 
std::unique_ptr< WorldPacketcreateChatPacket (uint8_t type, uint32_t language, std::string msg, Unit *receiver=nullptr, uint32_t sessionLanguage=0)
 
void sendChatMessage (uint8_t type, uint32_t language, std::string msg, Unit *receiver=nullptr, uint32_t sessionLanguage=0)
 
void sendChatMessage (uint8_t type, uint32_t language, std::string msg, uint32_t delay)
 
void sendChatMessage (MySQLStructure::NpcScriptText const *text, uint32_t delay, Unit *target=nullptr)
 
void sendChatMessageToPlayer (uint8_t type, uint32_t language, std::string msg, Player *plr)
 
void sendChatMessageAlternateEntry (uint32_t entry, uint8_t type, uint32_t lang, std::string msg)
 
void setAttackTimer (WeaponDamageType type, uint32_t time)
 
uint32_t getAttackTimer (WeaponDamageType type) const
 
bool isAttackReady (WeaponDamageType type) const
 
void resetAttackTimer (WeaponDamageType type)
 
void modAttackSpeedModifier (WeaponDamageType type, int32_t amount)
 
float getAttackSpeedModifier (WeaponDamageType type) const
 
void sendEnvironmentalDamageLogPacket (uint64_t guid, uint8_t type, uint32_t damage, uint64_t unk=0)
 
void restoreDisplayId ()
 
bool isSitting () const
 
void emote (EmoteType emote)
 
void eventAddEmote (EmoteType emote, uint32_t time)
 
void emoteExpire ()
 
uint32_t getOldEmote () const
 
void dealDamage (Unit *victim, uint32_t damage, uint32_t spellId, bool removeAuras=true)
 
void takeDamage (Unit *attacker, uint32_t damage, uint32_t spellId)
 
void addSimpleDamageBatchEvent (uint32_t damage, Unit *attacker=nullptr, SpellInfo const *spellInfo=nullptr)
 
void addSimpleEnvironmentalDamageBatchEvent (EnviromentalDamage type, uint32_t damage, uint32_t absorbedDamage=0)
 
void addSimpleHealingBatchEvent (uint32_t heal, Unit *healer=nullptr, SpellInfo const *spellInfo=nullptr)
 
void addHealthBatchEvent (std::unique_ptr< HealthBatchEvent > batch)
 
uint32_t calculateEstimatedOverKillForCombatLog (uint32_t damage) const
 
uint32_t calculateEstimatedOverHealForCombatLog (uint32_t heal) const
 
void clearHealthBatch ()
 
void clearCasterFromHealthBatch (Unit const *caster)
 
uint32_t absorbDamage (SchoolMask schoolMask, uint32_t *dmg, bool checkOnly=true)
 
void smsg_AttackStart (Unit *pVictim)
 
void smsg_AttackStop (Unit *pVictim)
 
void clearInRangeSets ()
 
bool setDetectRangeMod (uint64_t guid, int32_t amount)
 
void unsetDetectRangeMod (uint64_t guid)
 
int32_t getDetectRangeMod (uint64_t guid) const
 
virtual bool isCritter ()
 
void knockbackFrom (float x, float y, float speedXY, float speedZ)
 
virtual bool isTrainingDummy ()
 
GameObjectgetGameObject (uint32_t spellId) const
 
void addGameObject (GameObject *gameObj)
 
void removeGameObject (GameObject *gameObj, bool del)
 
void removeGameObject (uint32_t spellId, bool del)
 
void removeAllGameObjects ()
 
void deMorph ()
 
bool isAlive () const
 
bool justDied () const
 
bool isDead () const
 
virtual void setDeathState (DeathState state)
 
DeathState getDeathState () const
 
PetgetPet () const
 
TotemSummongetTotem (SummonSlot slot) const
 
SummonHandlergetSummonInterface ()
 
SummonHandler constgetSummonInterface () const
 
void handleSpellClick (Unit *clicker)
 
bool isMounted () const
 
void mount (uint32_t mount, uint32_t vehicleId=0, uint32_t creatureEntry=0)
 
void dismount (bool resummonPet=true)
 
bool isUnitOwnerInParty (Unit *unit)
 
bool isUnitOwnerInRaid (Unit *unit)
 
ThreatManagergetThreatManager ()
 
ThreatManager constgetThreatManager () const
 
void clearHateList ()
 
void wipeHateList ()
 
void wipeTargetList ()
 
int32_t getThreatModifyer ()
 
void modThreatModifyer (int32_t mod)
 
int32_t getGeneratedThreatModifyer (uint32_t school)
 
void modGeneratedThreatModifyer (uint32_t school, int32_t mod)
 
void setTaggerGuid (Unit const *tagger)
 
uint64_t getTaggerGuid () const
 
bool isTagged () const
 
bool isTaggableFor (Unit const *unit) const
 
bool isTaggedByPlayerOrItsGroup (Player *tagger)
 
bool isLootable ()
 
void buildMovementPacket (ByteBuffer *data)
 
void buildMovementPacket (ByteBuffer *data, float x, float y, float z, float o)
 
void possess (Unit *unitTarget, uint32_t delay=0)
 
void unPossess ()
 
uint16_t hasNoInterrupt () const
 
void removeGarbage ()
 
void addGarbageAura (std::unique_ptr< Aura > aur)
 
void addGarbagePet (Pet *pet)
 
virtual void deactivate (WorldMap *mgr)
 
float getChanceToDaze (Unit *target)
 
void eventModelChange ()
 
void aggroPvPGuards ()
 
void setTriggerStunOrImmobilize (uint32_t newTrigger, uint32_t newChance, bool isVictim=false)
 
void eventStunOrImmobilize (Unit *unitProcTarget, bool isVictim=false)
 
void setTriggerChill (uint32_t newTrigger, uint32_t newChance, bool isVictim=false)
 
void eventChill (Unit *unitProcTarget, bool isVictim=false)
 
void removeExtraStrikeTarget (SpellInfo const *spellInfo)
 
void addExtraStrikeTarget (SpellInfo const *spellInfo, uint32_t charges)
 
uint32_t doDamageSplitTarget (uint32_t res, SchoolMask schoolMask, bool isMeleeDmg)
 
void removeReflect (uint32_t spellId, bool apply)
 
void castOnMeleeSpell ()
 
uint64_t getAuraUpdateMaskForRaid () const
 
void resetAuraUpdateMaskForRaid ()
 
void setAuraUpdateMaskForRaid (uint8_t slot)
 
void updateAuraForGroup (uint8_t slot)
 
void giveGroupXP (Unit *unitVictim, Player *playerInGroup)
 
void calculateResistanceReduction (Unit *unitVictim, DamageInfo *damageInfo, SpellInfo const *spellInfoAbility, float armorPctReduce)
 
bool removeAurasByHeal ()
 
bool auraActionIf (AuraAction *auraAction, AuraCondition *auraCondition)
 
uint32_t getManaShieldAbsorbedDamage (uint32_t damage)
 
AuraCheckResponse auraCheck (SpellInfo const *spellInfo, Object *caster=nullptr)
 
AuraCheckResponse auraCheck (SpellInfo const *spellInfo, Aura *aura, Object *caster=nullptr)
 
uint32_t getSpellDidHitResult (Unit *pVictim, uint32_t weapon_damage_type, Spell *castingSpell)
 Combat.
 
DamageInfo strike (Unit *pVictim, WeaponDamageType weaponType, SpellInfo const *ability, int32_t add_damage, int32_t pct_dmg_mod, uint32_t exclusive_damage, bool disable_proc, bool skip_hit_check, bool force_crit=false, Spell *castingSpell=nullptr)
 
uint32_t handleProc (uint32_t flag, Unit *Victim, SpellInfo const *CastingSpell, DamageInfo damageInfo, bool isSpellTriggered, ProcEvents procEvent=PROC_EVENT_DO_ALL, Aura *triggeredFromAura=nullptr)
 
void handleProcDmgShield (uint32_t flag, Unit *attacker)
 
WDB::Structures::MountCapabilityEntry constgetMountCapability (uint32_t mountType)
 
void setOnMeleeSpell (uint32_t spellId, uint8_t ecn=0)
 
uint32_t getOnMeleeSpell () const
 
uint8_t getOnMeleeSpellEcn () const
 
void setHitFromMeleeSpell (float value)
 
float getHitFromMeleeSpell ()
 
uint32_t isPacified () const
 
uint32_t isStunned () const
 
uint32_t isFeared () const
 
uint32_t getResistChanceMod () const
 
void setResistChanceMod (uint32_t amount)
 
void setcanparry (bool newstatus)
 
uint32_t getCharmTempVal () const
 
void setCharmTempVal (uint32_t val)
 
void setDiminishTimer (uint32_t index)
 
float getModelHalfSize () const
 
float getCollisionHeight () const override
 
float getBlockFromSpell () const
 
float getParryFromSpell () const
 
float getDodgeFromSpell () const
 
void setBlockFromSpell (float value)
 
void setParryFromSpell (float value)
 
void setDodgeFromSpell (float value)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
void Update (unsigned long)
 
void PushToWorld (WorldMap *)
 
bool IsInWorld () const
 
virtual void OnPreRemoveFromWorld ()
 
virtual void OnRemoveFromWorld ()
 
bool write (const uint8_t &member, uint8_t val, bool skipObjectUpdate=false)
 
bool write (const uint16_t &member, uint16_t val, bool skipObjectUpdate=false)
 
bool write (const float &member, float val, bool skipObjectUpdate=false)
 
bool write (const int32_t &member, int32_t val, bool skipObjectUpdate=false)
 
bool write (const uint32_t &member, uint32_t val, bool skipObjectUpdate=false)
 
bool write (const uint64_t &member, uint64_t val, bool skipObjectUpdate=false)
 
bool write (const uint64_t &member, uint32_t low, uint32_t high, bool skipObjectUpdate=false)
 
bool writeLow (const uint64_t &member, uint32_t val, bool skipObjectUpdate=false)
 
bool writeHigh (const uint64_t &member, uint32_t val, bool skipObjectUpdate=false)
 
uint64_t getGuid () const
 
void setGuid (uint64_t guid)
 
void setGuid (uint32_t low, uint32_t high)
 
uint32_t getGuidLow () const
 
void setGuidLow (uint32_t low)
 
uint32_t getGuidHigh () const
 
void setGuidHigh (uint32_t high)
 
uint16_t getOType () const
 
void setOType (uint16_t type)
 
void setObjectType (uint8_t objectTypeId)
 
void setEntry (uint32_t entry)
 
uint32_t getEntry () const
 
uint16_t getDynamicFlags () const
 
int16_t getDynamicPathProgress () const
 
void setDynamicFlags (uint16_t dynamicFlags)
 
void addDynamicFlags (uint16_t dynamicFlags)
 
void removeDynamicFlags (uint16_t dynamicFlags)
 
bool hasDynamicFlags (uint16_t dynamicFlags) const
 
void setDynamicPathProgress (int16_t pathProgress)
 
float getScale () const
 
void setScale (float scaleX)
 
void updateObject ()
 
void forceBuildUpdateValueForField (uint32_t field, Player *target)
 
void forceBuildUpdateValueForFields (uint32_t const *fields, Player *target)
 
uint8_t getObjectTypeId () const
 
bool isCreatureOrPlayer () const
 
bool isPlayer () const
 
bool isCreature () const
 
bool isItem () const
 
bool isGameObject () const
 
bool isCorpse () const
 
bool isContainer () const
 
virtual bool isPet () const
 
virtual bool isTotem () const
 
virtual bool isSummon () const
 
virtual bool isVehicle () const
 
virtual bool isTransporter () const
 
bool isInRange (LocationVector location, float square_r) const
 
bool isInRange (float x, float y, float z, float square_r) const
 
float getDistanceSq (LocationVector target) const
 
float getDistanceSq (float x, float y, float z) const
 
SpellgetCurrentSpell (CurrentSpellType spellType) const
 
SpellgetCurrentSpellById (uint32_t spellId) const
 
void setCurrentSpell (Spell *curSpell)
 
void interruptSpell (uint32_t spellId=0, bool checkMeleeSpell=true)
 
void interruptSpellWithSpellType (CurrentSpellType spellType)
 
bool isCastingSpell (bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false) const
 
SpellfindCurrentCastedSpellBySpellId (uint32_t spellId)
 
DamageInfo doSpellDamage (Unit *victim, uint32_t spellId, float_t damage, uint8_t effIndex, bool isTriggered=false, bool isPeriodic=false, bool isLeech=false, bool forceCrit=false, Spell *spell=nullptr, Aura *aur=nullptr, AuraEffectModifier *aurEff=nullptr)
 
DamageInfo doSpellHealing (Unit *victim, uint32_t spellId, float_t heal, bool isTriggered=false, bool isPeriodic=false, bool isLeech=false, bool forceCrit=false, Spell *spell=nullptr, Aura *aur=nullptr, AuraEffectModifier *aurEff=nullptr)
 
void _UpdateSpells (uint32_t time)
 
void addTravelingSpell (Spell *spell)
 
void removeTravelingSpell (Spell *spell)
 
void addGarbageSpell (Spell *spell)
 
void removeGarbageSpells ()
 
void removeSpellModifierFromCurrentSpells (AuraEffectModifier const *aur)
 
void removeSelfFromInrangeSets ()
 
std::vector< Object * > getInRangeObjectsSet () const
 
bool hasInRangeObjects () const
 
size_t getInRangeObjectsCount () const
 
bool isObjectInInRangeObjectsSet (Object *pObj) const
 
void removeObjectFromInRangeObjectsSet (Object *pObj)
 
std::vector< Object * > getInRangePlayersSet () const
 
size_t getInRangePlayersCount () const
 
std::vector< Object * > getInRangeOppositeFactionSet () const
 
bool isObjectInInRangeOppositeFactionSet (Object *pObj) const
 
void updateInRangeOppositeFactionSet ()
 
void addInRangeOppositeFaction (Object *obj)
 
void removeObjectFromInRangeOppositeFactionSet (Object *obj)
 
std::vector< Object * > getInRangeSameFactionSet () const
 
bool isObjectInInRangeSameFactionSet (Object *pObj) const
 
void updateInRangeSameFactionSet ()
 
void addInRangeSameFaction (Object *obj)
 
void removeObjectFromInRangeSameFactionSet (Object *obj)
 
void sendGameobjectDespawnAnim ()
 
const WoWGuidGetNewGUID () const
 
uint32_t GetTypeFromGUID () const
 
uint32_t GetUIdFromGUID () const
 
bool IsType (TYPE type_mask) const
 
uint32_t BuildValuesUpdateBlockForPlayer (ByteBuffer *buf, Player *target)
 
uint32_t BuildValuesUpdateBlockForPlayer (ByteBuffer *buf, UpdateMask *mask)
 
void BuildFieldUpdatePacket (Player *Target, uint32_t Index, uint32_t Value)
 
void BuildFieldUpdatePacket (ByteBuffer *buf, uint32_t Index, uint32_t Value)
 
void updatePositionData ()
 
bool SetPosition (float newX, float newY, float newZ, float newOrientation, bool allowPorting=false)
 
bool SetPosition (const LocationVector &v, bool allowPorting=false)
 
const float & GetPositionX () const
 
const float & GetPositionY () const
 
const float & GetPositionZ () const
 
const float & GetOrientation () const
 
void SetOrientation (float o)
 
void SetSpawnLocation (float newX, float newY, float newZ, float newOrientation)
 
void SetSpawnLocation (LocationVector loc)
 
const float & GetSpawnX () const
 
const float & GetSpawnY () const
 
const float & GetSpawnZ () const
 
const float & GetSpawnO () const
 
LocationVector GetSpawnPosition () const
 
::WDB::Structures::AreaTableEntry constGetArea () const
 
void getPosition (float &x, float &y) const
 
void getPosition (float &x, float &y, float &z) const
 
void getPosition (float &x, float &y, float &z, float &o) const
 
LocationVector GetPosition () const
 
LocationVectorGetPositionNC ()
 
LocationVectorGetPositionV ()
 
void SetTransport (Transporter *t)
 
TransporterGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32_t GetTransTime () const
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
SummonToSummon ()
 
Summon constToSummon () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
float getExactDist2dSq (const float x, const float y) const
 
float getExactDist2dSq (LocationVector const &pos) const
 
float getExactDist2dSq (LocationVector const *pos) const
 
float getExactDist2d (const float x, const float y) const
 
float getExactDist2d (LocationVector const &pos) const
 
float getExactDist2d (LocationVector const *pos) const
 
float getExactDistSq (float x, float y, float z) const
 
float getExactDistSq (LocationVector const &pos) const
 
float getExactDistSq (LocationVector const *pos) const
 
float getExactDist (float x, float y, float z) const
 
float getExactDist (LocationVector const &pos) const
 
float getExactDist (LocationVector const *pos) const
 
float getDistance (Object const *obj) const
 
float getDistance (LocationVector const &pos) const
 
float getDistance (float x, float y, float z) const
 
float getDistance2d (Object const *obj) const
 
float getDistance2d (float x, float y) const
 
float getDistanceZ (Object const *obj) const
 
float CalcDistance (Object *Ob)
 
float CalcDistance (float ObX, float ObY, float ObZ)
 
float CalcDistance (Object *Oa, Object *Ob)
 
float CalcDistance (Object *Oa, float ObX, float ObY, float ObZ)
 
float CalcDistance (float OaX, float OaY, float OaZ, float ObX, float ObY, float ObZ)
 
bool IsInMap (Object *obj)
 
bool IsWithinDistInMap (Object *obj, const float dist2compare) const
 
bool IsWithinLOSInMap (Object *obj)
 
bool IsWithinLOS (LocationVector location)
 
MapCellGetMapCell () const
 
uint32_t GetMapCellX ()
 
uint32_t GetMapCellY ()
 
void SetMapCell (MapCell *cell)
 
WorldMapgetWorldMap () const
 
ObjectgetWorldMapObject (const uint64_t &guid) const
 
PetgetWorldMapPet (const uint64_t &guid) const
 
UnitgetWorldMapUnit (const uint64_t &guid) const
 
PlayergetWorldMapPlayer (const uint64_t &guid) const
 
CreaturegetWorldMapCreature (const uint64_t &guid) const
 
GameObjectgetWorldMapGameObject (const uint64_t &guid) const
 
DynamicObjectgetWorldMapDynamicObject (const uint64_t &guid) const
 
void SetMapId (uint32_t newMap)
 
void setZoneId (uint32_t newZone)
 
void setAreaId (uint32_t area)
 
uint32_t GetMapId () const
 
const uint32_tgetZoneId () const
 
const uint32_tgetAreaId () const
 
bool isOutdoors () const
 
ZLiquidStatus getLiquidStatus () const
 
void SetNewGuid (uint32_t Guid)
 
void ClearUpdateMask ()
 
bool HasUpdateField (uint32_t index)
 
bool isInRange (Object *target, float range)
 
bool isInFront (Object *target)
 
bool isInBack (Object *target)
 
bool isInArc (Object *target, float degrees)
 
bool HasInArc (float degrees, Object *target)
 
float calcAngle (float Position1X, float Position1Y, float Position2X, float Position2Y)
 
float calcRadAngle (float Position1X, float Position1Y, float Position2X, float Position2Y)
 
float getEasyAngle (float angle)
 
float getAbsoluteAngle (float x, float y) const
 
float getAbsoluteAngle (LocationVector const &pos)
 
float getAbsoluteAngle (Object const *obj)
 
float getAbsoluteAngle (LocationVector const *pos) const
 
float toAbsoluteAngle (float relAngle) const
 
float toRelativeAngle (float absAngle) const
 
float getRelativeAngle (Object const *obj)
 
float getRelativeAngle (float x, float y) const
 
float getRelativeAngle (LocationVector const &pos) const
 
float getRelativeAngle (LocationVector const *pos) const
 
bool isInDist2d (LocationVector const &pos, float dist) const
 
bool isInDist (Object *pos, float dist)
 
bool isInDist (LocationVector const &pos, float dist)
 
void getNearPoint2D (Object *searcher, float &x, float &y, float distance, float absAngle)
 
void getNearPoint (Object *searcher, float &x, float &y, float &z, float distance2d, float absAngle)
 
void getClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0)
 
LocationVector getHitSpherePointFor (LocationVector const &dest)
 
void getHitSpherePointFor (LocationVector const &dest, float &x, float &y, float &z) const
 
LocationVector getHitSpherePointFor (LocationVector const &dest) const
 
void updateGroundPositionZ (float x, float y, float &z)
 
void updateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr)
 
float getMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr)
 
float getFloorZ ()
 
float getMapHeight (LocationVector pos, bool vmap=true, float distanceToSearch=50.0f)
 
void movePositionToFirstCollision (LocationVector &pos, float dist, float angle)
 
LocationVector getFirstCollisionPosition (float dist, float angle)
 
GameObjectsummonGameObject (uint32_t entryID, LocationVector pos, QuaternionData const &rot, uint32_t spawnTime=0, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreaturesummonCreature (uint32_t entry, LocationVector position, CreatureSummonDespawnType despawnType=MANUAL_DESPAWN, uint32_t duration=0, uint32_t spellId=0)
 
float getDistanceSq (Object const *obj) const
 
float CalcDistance (LocationVector &comp)
 
float GetDistance2dSq (Object *obj)
 
void SendCreatureChatMessageInRange (Creature *creature, uint32_t textId, Unit *target=nullptr)
 
virtual void sendMessageToSet (WorldPacket *data, Player const *)
 
void SendAIReaction (uint32_t reaction=2)
 
void SendDestroyObject ()
 
uint16_t GetValuesCount () const
 
uint32_t GetPhase () const
 
virtual void Phase (uint8_t command=PHASE_SET, uint32_t newphase=1)
 
void SendSpellLog (Object *Caster, Object *Target, uint32_t Ability, uint8_t SpellLogType)
 SpellLog packets just to keep the code cleaner and better to read.
 
void setServersideFaction ()
 
uint32_t getServersideFaction ()
 
Standing getEnemyReaction (Object *target)
 
Standing getFactionReaction (WDB::Structures::FactionTemplateEntry const *factionTemplateEntry, Object *target)
 
bool isHostileTo (Object *target)
 
bool IsHostileToPlayers ()
 
bool isFriendlyTo (Object *target)
 
bool isNeutralTo (Object *target) const
 
bool isNeutralToAll () const
 
bool isValidTarget (Object *target, SpellInfo const *bySpell=nullptr)
 
bool isValidAssistTarget (Unit *target, SpellInfo const *bySpell=nullptr)
 
void SetInstanceID (int32_t instance)
 
int32_t GetInstanceID ()
 
int32_t event_GetInstanceID ()
 this func needs to be implemented by all eventable classes. use it to retrieve the instance id that it needs to attach itself to.
 
bool IsActive ()
 
virtual bool CanActivate ()
 Object has an active state.
 
virtual void Activate (WorldMap *mgr)
 
void SetMapMgr (WorldMap *mgr)
 
void Delete ()
 
void PlaySoundToSet (uint32_t sound_entry)
 
bool IsInBg ()
 
uint32_t GetTeam () const
 
bool GetPoint (float angle, float rad, float &outx, float &outy, float &outz, bool sloppypath=false)
 
bool GetRandomPoint (float rad, float &outx, float &outy, float &outz)
 
bool GetRandomPoint (float rad, LocationVector &out)
 
- Public Member Functions inherited from EventableObject
uint32_t event_GetEventPeriod (uint32_t EventType)
 
 EventableObject ()
 
virtual ~EventableObject ()
 
bool event_HasEvents ()
 
void event_AddEvent (std::shared_ptr< TimedEvent > ptr)
 
void event_Relocate ()
 

Static Public Member Functions

static void changeLooks (uint64_t guid, uint8_t gender, uint8_t skin, uint8_t face, uint8_t hairStyle, uint8_t hairColor, uint8_t facialHair)
 
static void changeLanguage (uint64_t guid, uint8_t race)
 
static void initVisibleUpdateBits ()
 
static Standing getReputationRankFromStanding (int32_t value)
 
static PlayerBytes3_DrunkValue getDrunkStateByValue (uint16_t value)
 

Public Attributes

bool m_isReadyToBeRemoved = false
 
bool m_isWaterBreathingEnabled = false
 
uint32_t m_underwaterTime = 180000
 
uint32_t m_underwaterMaxTime = 180000
 
uint32_t m_underwaterState = 0
 
uint32_t m_underwaterLastDamage
 
uint32_t m_explorationTimer
 
SpellOverrideMap m_spellOverrideMap
 
float m_resistCritical [2] = { 0 }
 
bool m_FirstCastAutoRepeat = false
 
PlayerCheat m_cheats = {false}
 
float m_goLastXRotation = 0.0f
 
float m_goLastYRotation = 0.0f
 
AIInterfacem_aiInterfaceWaypoint = nullptr
 
bool m_isGmInvisible = false
 
Creaturem_formationMaster = nullptr
 
bool m_hasBindDialogOpen = false
 
BGScore m_bgScore
 
std::map< uint32_t, uint32_tm_wratings
 
float m_offhandDmgMod = 0.5f
 
bool m_firstLogin = false
 
uint16_t m_maxTalentPoints = 0
 
uint8_t m_talentSpecsCount = 1
 
uint8_t m_talentActiveSpec = 0
 
uint32_t m_FirstTalentTreeLock = 0
 
PlayerSpec m_spec
 
float m_spellHasteRatingBonus = 1.0f
 
uint32_t m_nextSave
 
int m_lifeTapBonus = 0
 
bool m_requiresNoAmmo = false
 
uint32_t m_modBlockAbsorbValue = 0
 
uint32_t m_modBlockValueFromSpells = 0
 
uint32_t m_flatResistanceModifierPos [TOTAL_SPELL_SCHOOLS] = { 0 }
 
uint32_t m_flatResistanceModifierNeg [TOTAL_SPELL_SCHOOLS] = { 0 }
 
uint32_t m_baseResistanceModPctPos [TOTAL_SPELL_SCHOOLS] = { 0 }
 
uint32_t m_baseResistanceModPctNeg [TOTAL_SPELL_SCHOOLS] = { 0 }
 
uint32_t m_resistanceModPctPos [TOTAL_SPELL_SCHOOLS] = { 0 }
 
uint32_t m_resistanceModPctNeg [TOTAL_SPELL_SCHOOLS] = { 0 }
 
float m_resistHit [2] = { 0 }
 
int32_t m_resistHitSpell [TOTAL_SPELL_SCHOOLS] = { 0 }
 
uint32_t m_modPhysCritDmgPct = 0
 
uint32_t m_rootedCritChanceBonus = 0
 
uint32_t m_increaseDmgSnaredSlowed = 0
 
uint32_t m_modInterrManaRegenPct = 0
 
int32_t m_modManaRegenFromStat [STAT_COUNT] = { 0 }
 
float m_RegenManaOnSpellResist = 0.0f
 
uint32_t m_castedAmount [TOTAL_SPELL_SCHOOLS] = { 0 }
 
uint32_t m_flatStatModPos [5] = { 0 }
 
uint32_t m_flatStatModNeg [5] = { 0 }
 
uint32_t m_statModPctPos [5] = { 0 }
 
uint32_t m_statModPctNeg [5] = { 0 }
 
uint32_t m_totalStatModPctPos [5] = { 0 }
 
uint32_t m_totalStatModPctNeg [5] = { 0 }
 
int32_t m_increaseDamageByType [12] = { 0 }
 
float m_increaseDamageByTypePct [12] = { 0 }
 
float m_increaseCricticalByTypePct [12] = { 0 }
 
int32_t m_detectedRange = 0
 
uint32_t m_retaineDrage = 0
 
uint64_t m_misdirectionTarget = 0
 
bool m_reincarnation = false
 
std::map< uint32_t, WeaponModifierm_damageDone
 
std::map< uint32_t, WeaponModifierm_toCritChance
 
bool m_cannibalize = false
 
uint8_t m_cannibalizeCount = 0
 
int32_t m_rageFromDamageDealt = 0
 
int32_t m_rageFromDamageTaken = 0
 
uint32_t m_trackingSpell = 0
 
uint32_t m_lastSeenWeather = 0
 
std::set< Object * > m_visibleFarsightObjects
 
BoundInstancesMap m_boundInstances [InstanceDifficulty::MAX_DIFFICULTY]
 
InstanceTimeMap m_instanceResetTimes
 
std::map< uint32_t, std::set< uint32_t > > m_summonSpells
 
std::map< uint32_t, std::map< SpellInfo const *, uint16_t > * > m_petSpells
 
bool m_blinked = false
 
bool m_beingPushed = false
 
uint32_t m_flyingAura = 0
 
bool m_changingMaps = true
 
bool m_resendSpeed = false
 
int32_t m_rapModPct = 0
 
bool m_deathVision = false
 
SpellInfo constm_lastHealSpell = nullptr
 
std::unique_ptr< Mailboxm_mailBox
 
bool m_finishingMovesDodge = false
 
std::map< uint32_t, Standingm_forcedReactions
 
bool m_passOnLoot = false
 
uint32_t m_tradeSequence
 
uint32_t m_outStealthDamageBonusPct = 0
 
uint32_t m_outStealthDamageBonusPeriod = 0
 
uint32_t m_outStealthDamageBonusTimer = 0
 
bool m_avengingWrath = true
 
- Public Attributes inherited from Unit
int32_t m_CombatResult_Dodge = 0
 
int32_t m_CombatResult_Parry = 0
 
float m_zAxisPosition = 0.0f
 
int32_t m_safeFall = 0
 
bool m_noFallDamage = false
 
uint8_t m_forced_speed_changes [MAX_SPEED_TYPE] = { 0 }
 
std::unique_ptr< MovementMgr::MoveSplinemovespline
 
Unitm_controledUnit = this
 
Playerm_playerControler = nullptr
 
float m_spellCritPercentage = 0.0f
 
int32_t m_silenced = 0
 
int32_t m_modlanguage = -1
 
uint32_t m_objectSlots [4] = { 0 }
 
Loot loot
 
uint16_t m_noInterrupt = 0
 
uint32_t m_triggerOnStun = 0
 
uint32_t m_triggerOnStunChance = 100
 
uint32_t m_triggerOnStunVictim = 0
 
uint32_t m_triggerOnStunChanceVictim = 100
 
uint32_t m_triggerOnChill = 0
 
uint32_t m_triggerOnChillChance = 100
 
uint32_t m_triggerOnChillVictim = 0
 
uint32_t m_triggerOnChillChanceVictim = 100
 
std::unique_ptr< DamageSplitTargetm_damageSplitTarget
 
std::list< std::unique_ptr< ReflectSpellSchool > > m_reflectSpellSchool
 
bool m_damageShieldsInUse = false
 
std::list< DamageProcm_damageShields
 
uint32_t m_canMove = 0
 
float m_hitFromMeleeSpell = 0.0f
 
int32_t m_pacified = 0
 
int32_t m_stunned = 0
 
int32_t m_fearModifiers = 0
 
int32_t m_resistChance = 0
 
uint32_t m_schoolCastPrevent [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_mechanicDurationPctMod [28] = {0}
 
int32_t m_damageTakenMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_damageTakenPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_damageTakenPctModOnHP35 = 1
 
float m_critMeleeDamageTakenPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_critRangedDamageTakenPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_rangedDamageTaken = 0
 
float m_baseDamage [2] = {0}
 
float m_baseOffhandDamage [2] = {0}
 
float m_baseRangedDamage [2] = {0}
 
int32_t m_rangeAttackPowerModifier = 0
 
int32_t m_attackPowerModifier = 0
 
uint64_t m_stalkedByGuid = 0
 
uint32_t m_dispels [10] = {0}
 
bool m_trackStealth = false
 
uint32_t m_mechanicsDispels [32] = {0}
 
float m_mechanicsResistancesPct [32] = {0}
 
float m_modDamageTakenByMechPct [32] = {0}
 
int32_t m_DoTPctIncrease [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_AOEDmgMod = 1.0f
 
float m_ignoreArmorPctMaceSpec = 0.0f
 
float m_ignoreArmorPct = 0.0f
 
std::map< uint32_t, Aura * > m_tempAuraMap
 
uint32_t m_baseResistance [TOTAL_SPELL_SCHOOLS] = {0}
 
uint32_t m_baseStats [5] = {0}
 
int32_t m_healDoneMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_healDonePctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_healTakenMod [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_healTakenPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
uint32_t m_schoolImmunityList [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_spellCritChanceSchool [TOTAL_SPELL_SCHOOLS] = {0}
 
float m_powerCostPctMod [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_attackerCritChanceMod [TOTAL_SPELL_SCHOOLS] = {0}
 
uint32_t m_spellDelayResist [TOTAL_SPELL_SCHOOLS] = {0}
 
int32_t m_creatureAttackPowerMod [12] = {0}
 
int32_t m_creatureRangedAttackPowerMod [12] = {0}
 
int32_t m_interruptRegen = 0
 
int32_t m_powerRegenPct = 0
 
int32_t m_extraAttacks = 0
 
bool m_extraStrikeTarget = false
 
int32_t m_extraStrikeTargetC = 0
 
std::list< std::unique_ptr< ExtraStrike > > m_extraStrikeTargets
 
int64_t m_magnetCasterGuid = 0
 
int8_t m_ascFrozen = 0
 
int8_t m_ascEnraged = 0
 
int8_t m_ascSeal = 0
 
int8_t m_ascBleed = 0
 
bool m_isDisarmed = false
 
uint64_t m_detectRangeGuids [5] = {0}
 
int32_t m_detectRangeMods [5] = {0}
 
uint16_t m_diminishCount [DIMINISHING_GROUP_COUNT] = {0}
 
uint8_t m_diminishAuraCount [DIMINISHING_GROUP_COUNT] = {0}
 
uint16_t m_diminishTimer [DIMINISHING_GROUP_COUNT] = {0}
 
bool m_diminishActive = false
 
DynamicObjectm_dynamicObject = nullptr
 
bool m_isProcInUse = false
 
bool m_isInvincible = false
 
Playerm_redirectSpellPackets = nullptr
 
struct { 
 
   int32_t   m_amount = 0 
 
   int32_t   m_max = 0 
 
m_soulSiphon 
 
- Public Attributes inherited from Object
MovementInfo obj_movement_info
 
uint32_t m_phase = 1
 
WDB::Structures::FactionTemplateEntry constm_factionTemplate = nullptr
 
WDB::Structures::FactionEntry constm_factionEntry = nullptr
 
bool m_inQueue = false
 
bool m_loadedFromDB = false
 
std::set< Spell * > m_pendingSpells
 

Static Public Attributes

static UpdateMask m_visibleUpdateMask
 

Protected Member Functions

void setCreateBits (UpdateMask *updateMask, Player *target) const
 
void setUpdateBits (UpdateMask *updateMask, Player *target) const
 
void _addCategoryCooldown (uint32_t categoryId, uint32_t time, uint32_t SpellId, uint32_t ItemId)
 
void _addCooldown (uint32_t type, uint32_t mis, uint32_t time, uint32_t SpellId, uint32_t ItemId)
 
void _loadPlayerCooldowns (QueryResult *result)
 
void _savePlayerCooldowns (QueryBuffer *buf)
 
void _saveQuestLogEntry (QueryBuffer *buf)
 
void _loadQuestLogEntry (QueryResult *result)
 
void _loadPet (QueryResult *result)
 
void _loadPetSpells (QueryResult *result)
 
void _savePet (QueryBuffer *buf, bool updateCurrentPetCache=false, Pet *currentPet=nullptr)
 
void _savePetSpells (QueryBuffer *buf)
 
void _eventAttack (bool offhand)
 
void _castSpellArea ()
 
- Protected Member Functions inherited from Unit
 Unit ()
 
void setFeared (bool apply)
 
void setConfused (bool apply)
 
void setStunned (bool apply)
 
void _regeneratePowersAtRegenUpdate (PowerType type)
 
- Protected Member Functions inherited from Object
const WoWObjectobjectData () const
 
void _Create (uint32_t mapid, float x, float y, float z, float ang)
 
void buildMovementUpdate (ByteBuffer *data, uint16_t updateFlags, Player *target)
 
void buildValuesUpdate (uint8_t updateType, ByteBuffer *data, UpdateMask *updateMask, Player *target)
 
bool inArc (float Position1X, float Position1Y, float FOV, float Orientation, float Position2X, float Position2Y)
 
- Protected Member Functions inherited from EventableObject
void event_RemoveEvents ()
 
void event_RemoveEvents (uint32_t EventType)
 
void event_ModifyTimeLeft (uint32_t EventType, time_t TimeLeft, bool unconditioned=false)
 
void event_ModifyTime (uint32_t EventType, time_t Time)
 
void event_ModifyTimeAndTimeLeft (uint32_t EventType, time_t Time)
 
bool event_HasEvent (uint32_t EventType)
 
void event_RemoveByPointer (TimedEvent *ev)
 
int32_t event_GetCurrentInstanceId () const
 
bool event_GetTimeLeft (uint32_t EventType, time_t *Time)
 

Protected Attributes

bool m_isMoving = false
 
bool m_isMovingFB = false
 
bool m_isStrafing = false
 
bool m_isTurning = false
 
bool m_isJumping = false
 
uint32_t m_mountSpellId = 0
 
uint32_t m_mountVehicleId = 0
 
float m_noseLevel = .0f
 
LocationVector m_sentTeleportPosition
 
uint8_t m_transferStatus = TRANSFER_NONE
 
uint32_t m_teleportState = 1
 
uint32_t m_indoorCheckTimer = 0
 
time_t m_fallDisabledUntil = 0
 
PlayerCreateInfo constm_playerCreateInfo = nullptr
 
WorldSessionm_session = nullptr
 
std::set< uint64_tm_visibleObjects
 
uint32_t m_lastPotionId = 0
 
PlayerCooldownMap m_cooldownMap [NUM_COOLDOWN_TYPES]
 
uint32_t m_globalCooldown = 0
 
uint32_t m_tutorials [8] = {0}
 
bool m_tutorialsDirty = true
 
std::list< ItemSetm_itemSets
 
int m_hearthOfWildPct = 0
 
std::list< LoginAuram_loginAuras
 
uint32_t m_AttackMsgTimer = 0
 
bool m_attacking = false
 
float m_blockFromSpellPct = 0.0f
 
float m_critFromSpell = 0.0f
 
float m_spellCritFromSpell = 0.0f
 
float m_hitFromSpell = 0.0f
 
uint32_t m_healthFromSpell = 0
 
uint32_t m_manaFromSpell = 0
 
uint32_t m_healthFromItems = 0
 
uint32_t m_manaFromItems = 0
 
uint8_t m_targetIcon = 0
 
uint32_t _fields [getSizeOfStructure(WoWPlayer)]
 
- Protected Attributes inherited from Unit
std::unique_ptr< MovementManageri_movementManager
 
std::unique_ptr< AIInterfacem_aiInterface
 
bool m_useAI = false
 
uint32_t m_lastAiInterfaceUpdateTime = 0
 
uint16_t m_healthRegenerateTimer = 0
 
uint16_t m_powerRegenerateTimer = 0
 
uint16_t m_powerUpdatePacketTime = 0
 
GameObjectList m_gameObj
 
DeathState m_deathState = ALIVE
 
std::list< std::unique_ptr< Aura > > m_GarbageAuras
 
std::list< Pet * > m_GarbagePets
 
uint64_t m_auraRaidUpdateMask = 0
 
bool m_extraAttackCounter = false
 
uint32_t m_meleeSpell = 0
 
uint8_t m_meleeSpell_ecn = 0
 
bool m_canParry = false
 
uint32_t m_tempCharm = 0
 
float m_modelHalfSize = 1.0f
 
float m_blockFromSpell = 0.0f
 
float m_dodgeFromSpell = 0.0f
 
float m_parryFromSpell = 0.0f
 
int32_t m_manashieldAmount = 0
 
uint32_t m_manaShieldId = 0
 
UniqueAuraTargetMap m_singleTargetAura
 
uint32_t m_blockModPct = 0
 
- Protected Attributes inherited from Object
union { 
 
   uint8_t *   wow_data_ptr 
 
   WoWObject *   wow_data 
 
   uint32_t *   m_uint32Values = nullptr 
 
};  
 
uint8_t m_objectTypeId = TYPEID_UNIT
 
WoWGuid m_wowGuid
 
uint16_t m_objectType
 
uint16_t m_updateFlag
 
bool m_outdoors
 
ZLiquidStatus m_liquidStatus
 
float m_staticFloorZ = -100000.0f
 
uint32_t m_zoneId = 0
 
uint32_t m_areaId = 0
 
uint32_t m_mapId = MAPID_NOT_IN_WORLD
 
WorldMapm_WorldMap = nullptr
 
uint32_t m_mapCell_x = uint32_t(-1)
 
uint32_t m_mapCell_y = uint32_t(-1)
 
LocationVector m_position = {0, 0, 0, 0}
 
LocationVector m_lastMapUpdatePosition
 
LocationVector m_spawnLocation = { 0, 0, 0, 0 }
 
uint16_t m_valuesCount = 0
 
UpdateMask m_updateMask
 
bool m_objectUpdated = false
 
int32_t m_instanceId = INSTANCEID_NOT_IN_WORLD
 
Transporterm_transport = nullptr
 
- Protected Attributes inherited from EventableObject
int32_t m_event_Instanceid
 
std::mutex m_lock
 
EventMap m_events
 
EventableObjectHolderm_holder
 

Private Member Functions

const WoWPlayerplayerData () const
 
void _addSpell (uint32_t spellId, uint16_t fromSkill=0, bool learningPreviousRanks=false, bool ignorePreviousRanks=false)
 
bool _removeSpell (uint32_t spellId, bool moveToDeleted, bool silently=false, bool removingPreviousRank=false, bool forceRemoveHigherRanks=false)
 
void _verifySkillValues (WDB::Structures::SkillLineEntry const *skillEntry, uint16_t *currentValue, uint16_t *maxValue, uint16_t *skillStep, bool *requireUpdate)
 
void _verifySkillValues (WDB::Structures::SkillLineEntry const *skillEntry, uint16_t *currentValue, uint16_t *maxValue, uint16_t *skillStep)
 
void _updateSkillFieldOnValueChange (const PlayerSkillFieldPosition fieldPosition, uint16_t skillStep, uint16_t currentValue, uint16_t maxValue)
 
void _updateSkillBonusFields (const PlayerSkillFieldPosition fieldPosition, uint16_t tempBonus, uint16_t permBonus)
 
void removeGarbageItems ()
 
void _spawnPet (PetCache const *petCache)
 

Private Attributes

LevelInfo constm_levelInfo = nullptr
 
WDB::Structures::ChrRacesEntry constm_dbcRace = nullptr
 
WDB::Structures::ChrClassesEntry constm_dbcClass = nullptr
 
uint32_t m_loadHealth = 0
 
uint32_t m_loadMana = 0
 
uint32_t m_classicMaxLevel = 60
 
utf8_string m_name
 
uint32_t m_loginFlag = LOGIN_NO_FLAG
 
uint32_t m_team = 0
 
uint32_t m_bgTeam = 0
 
uint32_t m_playedTime [3] = { 0, 0, static_cast<uint32_t>(UNIXTIME) }
 
uint32_t m_onlineTime = static_cast<uint32_t>(UNIXTIME)
 
uint32_t m_timeLogoff = 0
 
CachedCharacterInfom_playerInfo = nullptr
 
UpdateManager m_updateMgr
 
bool m_enteringWorld = false
 
uint16_t m_holyPowerRegenerateTimer = 0
 
uint16_t m_foodDrinkSpellVisualTimer = 5000
 
SpellSet m_spellSet
 
SpellSet m_deletedSpellSet
 
SpellSet m_shapeshiftSpells
 
bool m_canDualWield2H = false
 
SkillMap m_skills
 
uint32_t armorProficiency = 0
 
uint32_t weaponProficiency = 0
 
uint64_t m_comboTarget = 0
 
int8_t m_comboPoints = 0
 
uint32_t m_talentPointsFromQuests = 0
 
uint32_t m_talentResetsCount = 0
 
bool m_resetTalents = false
 
std::unique_ptr< TradeDatam_TradeData
 
std::mutex m_tradeMutex
 
bool m_disableAppearing = false
 
bool m_disableSummoning = false
 
uint64_t m_GMSelectedGO = 0
 
uint32_t m_banned = 0
 
std::string m_banreason
 
uint32_t m_kickDelay = 0
 
SummonData m_summonData
 
std::string afkReason
 
std::vector< uint32_tm_gmPlayerTargetList
 
std::mutex m_lockGMTargetList
 
std::unique_ptr< ItemInterfacem_itemInterface
 
std::list< std::unique_ptr< Item > > m_GarbageItems
 
uint8_t m_dungeonDifficulty = 0
 
uint8_t m_raidDifficulty = 0
 
CorpseData m_corpseData
 
bool m_isCorpseCreationAllowed = true
 
uint64_t m_resurrecter = 0
 
uint32_t m_resurrectHealth = 0
 
uint32_t m_resurrectMana = 0
 
uint32_t m_resurrectInstanceID = 0
 
uint32_t m_resurrectMapId = 0
 
LocationVector m_resurrectPosition = { 0, 0, 0, 0 }
 
uint64_t m_areaSpiritHealerGuid = 0
 
BindData m_bindData
 
BGEntryData m_bgEntryData
 
std::array< Charter *, NUM_CHARTER_TYPESm_charters = { nullptr }
 
uint32_t m_invitedByGuildId = 0
 
uint32_t m_grouIdpInviterId = 0
 
bool m_sendOnlyRaidgroup = false
 
LocationVector m_lastGroupPosition
 
uint32_t m_groupUpdateFlags
 
std::set< Channel * > m_channels
 
std::mutex m_mutexChannel
 
std::array< ArenaTeam *, NUM_ARENA_TEAM_TYPESm_arenaTeams = { nullptr }
 
uint32_t m_arenaPoints = 0
 
uint32_t m_inviteArenaTeamId = 0
 
uint32_t m_honorPoints = 0
 
uint32_t m_honorRolloverTime = 0
 
uint32_t m_lastHonorResetTime = 0
 
uint32_t m_honorToday = 0
 
uint32_t m_honorYesterday = 0
 
uint32_t m_honorless = 0
 
uint32_t m_killsToday = 0
 
uint32_t m_killsLifetime = 0
 
uint32_t m_killsYesterday = 0
 
uint32_t m_pvpTimer = 0
 
Battlegroundm_bg = nullptr
 
Battlegroundm_pendingBattleground = nullptr
 
bool m_isQueuedForBg = false
 
uint32_t m_queuedBgInstanceId = 0
 
bool m_isQueuedForRbg = false
 
bool m_hasWonRbgToday = false
 
uint32_t m_bgQueueType = 0
 
bool m_bgHasFlag = false
 
uint8_t m_roles = 0
 
std::array< std::unique_ptr< QuestLogEntry >, MAX_QUEST_LOG_SIZEm_questlog
 
std::mutex m_mutextDailies
 
std::set< uint32_tm_finishedDailies = {}
 
std::set< uint32_tm_removequests = {}
 
std::set< uint32_tm_finishedQuests = {}
 
uint32_t m_questSharer = 0
 
std::set< uint32_tquest_spells = {}
 
std::set< uint32_tquest_mobs = {}
 
std::vector< SocialFriendsm_socialIFriends = {}
 
std::mutex m_mutexFriendList
 
std::vector< uint32_tm_socialFriendedByGuids = {}
 
std::mutex m_mutexFriendedBy
 
std::vector< uint32_tm_socialIgnoring = {}
 
std::mutex m_mutexIgnoreList
 
std::unique_ptr< SpeedCheatDetectorm_speedCheatDetector
 
std::unique_ptr< TaxiPathm_taxi
 
uint64_t m_lootGuid = 0
 
uint64_t m_currentLoot = 0
 
bool m_lootableOnCorpse = false
 
ReputationMap m_reputation
 
int32_t m_pctReputationMod = 0
 
FactionReputationm_reputationByListId [128] = { nullptr }
 
uint32_t m_championingFactionId = 0
 
uint32_t m_drunkTimer = 0
 
uint16_t m_serversideDrunkValue = 0
 
Playerm_duelPlayer = nullptr
 
uint8_t m_duelStatus = 0
 
uint8_t m_duelState = DUEL_STATE_FINISHED
 
uint32_t m_duelCountdownTimer = 0
 
bool m_isXpGainAllowed = true
 
uint8_t m_isResting = 0
 
uint8_t m_restState = 0
 
uint32_t m_restAmount = 0
 
PetCacheMap m_cachedPets
 
std::map< uint8_t, uint8_tm_cachedPetSlots
 
uint8_t m_battlegroundLastPetId = 0
 
uint32_t m_battlegroundLastPetSpell = 0
 
uint8_t m_stableSlotCount = 0
 
uint8_t m_maxPetNumber = 0
 
Objectm_summonedObject = nullptr
 
uint16_t m_spellAreaUpdateTimer = 1000
 
uint16_t m_pendingPacketTimer = 100
 
uint16_t m_partyUpdateTimer = 1000
 
uint32_t m_itemUpdateTimer = 0
 
uint32_t m_timeSyncCounter = 0
 
uint32_t m_timeSyncTimer = 0
 
uint32_t m_timeSyncClient = 0
 
uint32_t m_timeSyncServer = 0
 
uint32_t m_pendingBindId = 0
 
uint32_t m_pendingBindTimer = 0
 

Friends

class WorldSession
 
class Pet
 

Additional Inherited Members

- Protected Types inherited from Unit
typedef std::list< GameObject * > GameObjectList
 

Detailed Description

Definition at line 101 of file Player.hpp.

Member Typedef Documentation

◆ BoundInstancesMap

typedef std::unordered_map<uint32_t , InstancePlayerBind> Player::BoundInstancesMap

Definition at line 2122 of file Player.hpp.

Constructor & Destructor Documentation

◆ Player()

Player::Player ( uint32_t  guid)

Definition at line 202 of file Player.cpp.

202 :
203 m_updateMgr(this, static_cast<size_t>(worldConfig.server.compressionThreshold), 40000, 30000, 1000),
205 m_mailBox(std::make_unique<Mailbox>(guid)),
206 m_speedCheatDetector(std::make_unique<SpeedCheatDetector>()),
208 m_TradeData(nullptr)
209{
210 //////////////////////////////////////////////////////////////////////////
214 //////////////////////////////////////////////////////////////////////////
215
216 //\todo Why is there a pointer to the same thing in a derived class? ToDo: sort this out..
218 memset(m_uint32Values, 0, (getSizeOfStructure(WoWPlayer)) * sizeof(uint32_t));
220
222 setGuidLow(guid);
223
224#if VERSION_STRING >= WotLK
225 setRuneRegen(0, 0.100000f);
226 setRuneRegen(1, 0.100000f);
227 setRuneRegen(2, 0.100000f);
228 setRuneRegen(3, 0.100000f);
229#endif
230
231 m_playerControler = this;
232
235
236 m_sentTeleportPosition.ChangeCoords({ 999999.0f, 999999.0f, 999999.0f });
237
238 // Zyres: initialise here because ItemInterface needs the guid from object data
239 m_itemInterface = std::make_unique<ItemInterface>(this);
240#if VERSION_STRING > TBC
241 // make_unique does not work with private ctor -Appled
242 m_achievementMgr = std::unique_ptr<AchievementMgr>(new AchievementMgr(this));
243#endif
244 m_taxi = std::make_unique<TaxiPath>();
245
248
249 std::fill(m_questlog.begin(), m_questlog.end(), nullptr);
250#if VERSION_STRING >= Cata
251 std::fill(_voidStorageItems.begin(), _voidStorageItems.end(), nullptr);
252#endif
253
254 // Override initialization from Unit class
256}
@ GROUP_UPDATE_FLAG_NONE
Definition Group.h:53
@ TYPEID_PLAYER
@ TYPE_PLAYER
#define getSizeOfStructure(s)
@ INTRATE_SAVE
Definition WorldConfig.h:48
#define worldConfig
Definition World.h:245
void ChangeCoords(const LocationVector &src)
void setGuidLow(uint32_t low)
Definition Object.cpp:305
void setObjectType(uint8_t objectTypeId)
Definition Object.cpp:348
UpdateMask m_updateMask
Definition Object.hpp:752
uint32_t * m_uint32Values
Definition Object.hpp:120
uint16_t m_valuesCount
Definition Object.hpp:749
uint16_t m_objectType
Definition Object.hpp:719
uint8_t m_objectTypeId
Definition Object.hpp:190
uint32_t m_nextSave
Definition Player.hpp:2040
UpdateManager m_updateMgr
Definition Player.hpp:783
uint32_t _fields[getSizeOfStructure(WoWPlayer)]
Definition Player.hpp:2225
uint32_t m_groupUpdateFlags
Definition Player.hpp:1324
uint32_t m_underwaterLastDamage
Definition Player.hpp:586
std::unique_ptr< ItemInterface > m_itemInterface
Definition Player.hpp:1148
std::array< std::unique_ptr< QuestLogEntry >, MAX_QUEST_LOG_SIZE > m_questlog
Definition Player.hpp:1521
void setRuneRegen(uint8_t rune, float regen)
Definition Player.cpp:1169
std::unique_ptr< TradeData > m_TradeData
Definition Player.hpp:1050
std::unique_ptr< TaxiPath > m_taxi
Definition Player.hpp:1629
std::unique_ptr< SpeedCheatDetector > m_speedCheatDetector
Definition Player.hpp:1575
std::unique_ptr< Mailbox > m_mailBox
Definition Player.hpp:2188
LocationVector m_sentTeleportPosition
Definition Player.hpp:629
uint32_t m_explorationTimer
Definition Player.hpp:649
Player * m_playerControler
Definition Unit.hpp:695
void setAttackPowerMultiplier(float multiplier)
Definition Unit.cpp:1655
void setRangedAttackPowerMultiplier(float multiplier)
Definition Unit.cpp:1694
ThreatManager & getThreatManager()
Definition Unit.hpp:1190
void SetCount(uint32_t valuesCount)
Definition UpdateMask.h:71
uint32_t getMSTime()
Definition Util.cpp:143
unsigned int uint32_t
Here is the call graph for this function:

◆ ~Player()

Player::~Player ( )

Definition at line 258 of file Player.cpp.

259{
261 {
262 sLogger.failure("Player deleted from non-logout player!");
263 sObjectMgr.removePlayer(this);
264 }
265
266 if (m_session)
267 {
268 m_session->SetPlayer(nullptr);
271 }
272
273 if (m_TradeData != nullptr)
274 cancelTrade(false);
275
276 if (Player* inviterPlayer = sObjectMgr.getPlayer(getGroupInviterId()))
277 inviterPlayer->setGroupInviterId(0);
278
279 if (m_duelPlayer != nullptr)
280 m_duelPlayer->m_duelPlayer = nullptr;
281
282 m_duelPlayer = nullptr;
283
284 m_cachedPets.clear();
286}
#define sLogger
Definition Logger.hpp:136
#define sObjectMgr
Player * m_duelPlayer
Definition Player.hpp:1726
uint32_t getGroupInviterId() const
Definition Player.cpp:7882
void cancelTrade(bool sendToSelfAlso, bool silently=false)
Definition Player.cpp:6511
PetCacheMap m_cachedPets
Definition Player.hpp:1801
bool m_isReadyToBeRemoved
Definition Player.hpp:123
WorldSession * m_session
Definition Player.hpp:788
void removeGarbageItems()
Definition Player.cpp:6970
void SetPlayer(Player *plr)
Here is the call graph for this function:

Member Function Documentation

◆ _addCategoryCooldown()

void Player::_addCategoryCooldown ( uint32_t  categoryId,
uint32_t  time,
uint32_t  SpellId,
uint32_t  ItemId 
)
protected

Definition at line 4575 of file Player.cpp.

4576{
4577 PlayerCooldownMap::iterator cooldownItr = m_cooldownMap[COOLDOWN_TYPE_CATEGORY].find(categoryId);
4578 if (cooldownItr != m_cooldownMap[COOLDOWN_TYPE_CATEGORY].end())
4579 {
4580 auto& playerCooldown = cooldownItr->second;
4581 if (playerCooldown.ExpireTime < time)
4582 {
4583 playerCooldown.ExpireTime = time;
4584 playerCooldown.ItemId = ItemId;
4585 playerCooldown.SpellId = SpellId;
4586 }
4587 }
4588 else
4589 {
4590 PlayerCooldown playerCooldown;
4591 playerCooldown.ExpireTime = time;
4592 playerCooldown.ItemId = ItemId;
4593 playerCooldown.SpellId = SpellId;
4594
4595 m_cooldownMap[COOLDOWN_TYPE_CATEGORY].insert(std::make_pair(categoryId, playerCooldown));
4596 }
4597
4598 sLogger.debug("Player::_addCategoryCooldown added cooldown for COOLDOWN_TYPE_CATEGORY category_type {} time {} item {} spell {}", categoryId, time - Util::getMSTime(), ItemId, SpellId);
4599}
@ COOLDOWN_TYPE_CATEGORY
PlayerCooldownMap m_cooldownMap[NUM_COOLDOWN_TYPES]
Definition Player.hpp:917
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addCooldown()

void Player::_addCooldown ( uint32_t  type,
uint32_t  mis,
uint32_t  time,
uint32_t  SpellId,
uint32_t  ItemId 
)
protected

Definition at line 4601 of file Player.cpp.

4602{
4603 PlayerCooldownMap::iterator cooldownItr = m_cooldownMap[type].find(mis);
4604 if (cooldownItr != m_cooldownMap[type].end())
4605 {
4606 auto& playerCooldown = cooldownItr->second;
4607 if (playerCooldown.ExpireTime < time)
4608 {
4609 playerCooldown.ExpireTime = time;
4610 playerCooldown.ItemId = ItemId;
4611 playerCooldown.SpellId = SpellId;
4612 }
4613 }
4614 else
4615 {
4616 PlayerCooldown playerCooldown;
4617 playerCooldown.ExpireTime = time;
4618 playerCooldown.ItemId = ItemId;
4619 playerCooldown.SpellId = SpellId;
4620
4621 m_cooldownMap[type].insert(std::make_pair(mis, playerCooldown));
4622 }
4623
4624 sLogger.debug("Player::_addCooldown added cooldown for type {} misc {} time {} item {} spell {}", type, mis, time - Util::getMSTime(), ItemId, SpellId);
4625}
type
Definition core.h:573
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addSpell()

void Player::_addSpell ( uint32_t  spellId,
uint16_t  fromSkill = 0,
bool  learningPreviousRanks = false,
bool  ignorePreviousRanks = false 
)
private

Definition at line 5431 of file Player.cpp.

5432{
5433 const auto* spellInfo = sSpellMgr.getSpellInfo(spellId);
5434 if (spellInfo == nullptr)
5435 return;
5436
5437 if (sSpellMgr.isSpellDisabled(spellId))
5438 return;
5439
5440 // Check if player already knows this spell
5441 if (hasSpell(spellId))
5442 return;
5443
5444 if (spellInfo->hasSpellRanks())
5445 {
5446 if (!learningPreviousRanks)
5447 {
5448 // Check if player has at one point known a higher rank of this spell
5449 const auto* higherRankInfo = spellInfo->getRankInfo()->getLastSpell();
5450 const auto isSingleRankAbility = spellInfo->canKnowOnlySingleRank();
5451 do
5452 {
5453 // If player can know only one rank of this spell rank chain, try find a existing higher rank
5454 // Possible lower ranks are removed when a higher rank is added to spell map
5455 if (isSingleRankAbility && hasSpell(higherRankInfo->getId()))
5456 return;
5457
5458 if (removeDeletedSpell(higherRankInfo->getId()))
5459 {
5460 // Possibly found a deleted higher rank, add it to player instead
5461 break;
5462 }
5463
5464 if (higherRankInfo->getId() == spellId)
5465 break;
5466
5467 higherRankInfo = higherRankInfo->getRankInfo()->getPreviousSpell();
5468 } while (higherRankInfo != nullptr);
5469
5470 if (higherRankInfo != nullptr)
5471 spellInfo = higherRankInfo;
5472 }
5473 else
5474 {
5475 // When learning previous ranks or talents make sure they are also deleted from deleted spells
5476 removeDeletedSpell(spellInfo->getId());
5477 }
5478
5479 if (!ignorePreviousRanks && !spellInfo->isTalent() && !spellInfo->canKnowOnlySingleRank())
5480 {
5481 // Add all previous ranks to player
5482 if (const auto* const previousSpell = spellInfo->getRankInfo()->getPreviousSpell())
5483 _addSpell(previousSpell->getId(), fromSkill, true);
5484 }
5485 }
5486 else
5487 {
5488 // Check if spell was deleted from player
5489 removeDeletedSpell(spellId);
5490 }
5491
5492 uint32_t supercededSpellId = 0;
5493 if (spellInfo->hasSpellRanks() && (spellInfo->canKnowOnlySingleRank() || spellInfo->isTalent()))
5494 {
5495 // If spell can have only one rank known move all previous ranks to deleted spells
5496 const auto* previousRank = spellInfo->getRankInfo()->getPreviousSpell();
5497 const auto moveToDeleted = !spellInfo->isTalent();
5498 const auto silently = !spellInfo->isTalent();
5499 while (previousRank != nullptr)
5500 {
5501 if (_removeSpell(previousRank->getId(), moveToDeleted, silently, true))
5502 {
5503 if (!spellInfo->isTalent())
5504 supercededSpellId = previousRank->getId();
5505 break;
5506 }
5507
5508 previousRank = previousRank->getRankInfo()->getPreviousSpell();
5509 }
5510 }
5511
5512 m_spellSet.emplace(spellInfo->getId());
5513
5514 if (IsInWorld())
5515 {
5516 if (!ignorePreviousRanks)
5517 {
5518 // If previous rank was found overwrite it in client with smsg_superceded packet
5519 if (supercededSpellId > 0)
5520 getSession()->SendPacket(SmsgSupercededSpell(supercededSpellId, spellInfo->getId()).serialise().get());
5521 else
5522 getSession()->SendPacket(SmsgLearnedSpell(spellInfo->getId()).serialise().get());
5523 }
5524
5525 // Cast talents and auto castable spells with learn spell effect
5526 if ((spellInfo->isTalent() || spellInfo->getAttributesEx() & ATTRIBUTESEX_AUTOCASTED_AT_SPELL_LEARN) && spellInfo->hasEffect(SPELL_EFFECT_LEARN_SPELL))
5527 {
5528 castSpell(getGuid(), spellInfo, true);
5529 }
5530 // Cast passive spells only if player has proper shapeshift form
5531 else if (spellInfo->isPassive())
5532 {
5533 if (spellInfo->getRequiredShapeShift() == 0 ||
5534 (getShapeShiftMask() != 0 && (spellInfo->getRequiredShapeShift() & getShapeShiftMask())) ||
5535 (getShapeShiftMask() == 0 && (spellInfo->getAttributesExB() & ATTRIBUTESEXB_NOT_NEED_SHAPESHIFT)))
5536 {
5537 // TODO: temporarily check for this custom flag, will be removed when spell system handles pets properly!
5538 if (((spellInfo->custom_c_is_flags & SPELL_FLAG_IS_EXPIREING_WITH_PET) == 0) || (spellInfo->custom_c_is_flags & SPELL_FLAG_IS_EXPIREING_WITH_PET && getPet() != nullptr))
5539 castSpell(getGuid(), spellInfo, true);
5540 }
5541 }
5542 }
5543
5544 // Add spell's skill line to player
5545 if (fromSkill == 0)
5546 {
5547 const auto teachesProfession = spellInfo->hasEffect(SPELL_EFFECT_SKILL) || spellInfo->hasEffect(SPELL_EFFECT_TRADE_SKILL);
5548 const auto raceMask = getRaceMask();
5549 const auto classMask = getClassMask();
5550
5551 const auto spellSkillRange = sSpellMgr.getSkillEntryRangeForSpell(spellId);
5552 for (const auto& [_, skillEntry] : spellSkillRange)
5553 {
5554 if (skillEntry->race_mask > 0 && !(skillEntry->race_mask & raceMask))
5555 continue;
5556
5557 if (skillEntry->class_mask > 0 && !(skillEntry->class_mask & classMask))
5558 continue;
5559
5560 const auto skillLine = static_cast<uint16_t>(skillEntry->skilline);
5561 if (hasSkillLine(skillLine))
5562 continue;
5563
5564 // Do not learn skill default spells if spell does not teach profession skills
5565 // This allows to make starting spells fully customizable
5566 // If skill default spells would be taught, then all default starting spells from DBC files are taught on first login
5567 addSkillLine(skillLine, 1, 0, !teachesProfession);
5568 }
5569 }
5570
5571#ifdef FT_ACHIEVEMENTS
5572 if (!IsInWorld())
5573 return;
5574
5575 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL, spellId, 1, 0);
5576 if (spellInfo->getMechanicsType() == MECHANIC_MOUNTED) // Mounts
5577 {
5578 // miscvalue1==777 for mounts, 778 for pets
5579 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_MOUNTS, 777, 0, 0);
5580 }
5581 else if (spellInfo->getEffect(0) == SPELL_EFFECT_SUMMON) // Companion pet?
5582 {
5583 // miscvalue1==777 for mounts, 778 for pets
5584 // make sure it's a companion pet, not some other summon-type spell
5585 if (const auto summonProperties = sSummonPropertiesStore.lookupEntry(spellInfo->getEffectMiscValueB(0)))
5586 {
5587 if (summonProperties->Slot == 5 || (summonProperties->Type == SUMMON_TYPE_COMPANION && summonProperties->Slot != 6))
5588 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_MOUNTS, 778, 0, 0);
5589 }
5590 }
5591#endif
5592}
@ ATTRIBUTESEXB_NOT_NEED_SHAPESHIFT
@ ATTRIBUTESEX_AUTOCASTED_AT_SPELL_LEARN
@ SPELL_EFFECT_SKILL
@ SPELL_EFFECT_TRADE_SKILL
@ SPELL_EFFECT_SUMMON
@ SPELL_EFFECT_LEARN_SPELL
@ SPELL_FLAG_IS_EXPIREING_WITH_PET
@ MECHANIC_MOUNTED
#define sSpellMgr
Definition SpellMgr.hpp:197
@ SUMMON_TYPE_COMPANION
SERVER_DECL WDB::WDBContainer< WDB::Structures::SummonPropertiesEntry > sSummonPropertiesStore
virtual std::unique_ptr< WorldPacket > serialise()
uint64_t getGuid() const
Definition Object.cpp:295
bool IsInWorld() const
Definition Object.hpp:98
bool hasSkillLine(uint16_t skillLine, bool strict=false) const
Definition Player.cpp:4912
void addSkillLine(uint16_t skillLine, uint16_t currentValue, uint16_t maxValue, bool noSpellLearning=false, bool initializeProfession=false)
Definition Player.cpp:4760
bool hasSpell(uint32_t spellId) const
Definition Player.cpp:3925
void _addSpell(uint32_t spellId, uint16_t fromSkill=0, bool learningPreviousRanks=false, bool ignorePreviousRanks=false)
Definition Player.cpp:5431
SpellSet m_spellSet
Definition Player.hpp:968
WorldSession * getSession() const
Definition Player.cpp:3131
bool removeDeletedSpell(uint32_t spellId)
Definition Player.cpp:3950
bool _removeSpell(uint32_t spellId, bool moveToDeleted, bool silently=false, bool removingPreviousRank=false, bool forceRemoveHigherRanks=false)
Definition Player.cpp:5594
SpellCastResult castSpell(uint64_t targetGuid, uint32_t spellId, bool triggered=false)
Definition Unit.cpp:3564
Pet * getPet() const
Definition Unit.cpp:7929
uint32_t getClassMask() const
Definition Unit.hpp:221
uint32_t getRaceMask() const
Definition Unit.hpp:217
uint32_t getShapeShiftMask() const
Definition Unit.hpp:483
void SendPacket(WorldPacket *packet)
unsigned short uint16_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _castSpellArea()

void Player::_castSpellArea ( )
protected

Definition at line 13528 of file Player.cpp.

13529{
13530 if (!IsInWorld())
13531 return;
13532
13534 return;
13535
13536 if (getWorldMap()->getCellByCoords(GetPositionX(), GetPositionY()) == nullptr)
13537 return;
13538
13539 uint32_t AreaId = 0;
13540 uint32_t ZoneId = 0;
13541
13542 getWorldMap()->getZoneAndAreaId(GetPhase(), ZoneId, AreaId, GetPosition());
13543
13544 ////////////////////////////////////////////////////////////////////////////////////////////////////
13545 // Cheks for Casting a Spell in Specified Area / Zone :D
13546
13547 // Spells get Casted in specified Area
13548 SpellAreaForAreaMapBounds saBounds = sSpellMgr.getSpellAreaForAreaMapBounds(AreaId);
13549 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
13550 if (itr->second->autoCast && itr->second->fitsToRequirements(this, ZoneId, AreaId))
13551 if (!hasAurasWithId(itr->second->spellId))
13552 castSpell(this, itr->second->spellId, true);
13553
13554
13555 // Some spells applied at enter into zone (with subzones)
13556 SpellAreaForAreaMapBounds szBounds = sSpellMgr.getSpellAreaForAreaMapBounds(ZoneId);
13557 for (SpellAreaForAreaMap::const_iterator itr = szBounds.first; itr != szBounds.second; ++itr)
13558 if (itr->second->autoCast && itr->second->fitsToRequirements(this, ZoneId, AreaId))
13559 if (!hasAurasWithId(itr->second->spellId))
13560 castSpell(this, itr->second->spellId, true);
13561
13562
13563 // Remove of Spells
13565 {
13566 if (auto* const aur = getAuraWithAuraSlot(i))
13567 {
13568 if (sSpellMgr.checkLocation(aur->getSpellInfo(), ZoneId, AreaId, this) == false)
13569 {
13570 SpellAreaMapBounds sab = sSpellMgr.getSpellAreaMapBounds(aur->getSpellId());
13571 if (sab.first != sab.second)
13572 removeAllAurasById(aur->getSpellId());
13573 }
13574 }
13575 }
13576}
std::pair< SpellAreaMap::const_iterator, SpellAreaMap::const_iterator > SpellAreaMapBounds
Definition SpellMgr.hpp:59
std::pair< SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator > SpellAreaForAreaMapBounds
Definition SpellMgr.hpp:62
LocationVector GetPosition() const
Definition Object.hpp:373
LocationVector m_position
Definition Object.hpp:744
const float & GetPositionX() const
Definition Object.hpp:354
WorldMap * getWorldMap() const
Definition Object.hpp:454
uint32_t GetPhase() const
Definition Object.hpp:636
const float & GetPositionY() const
Definition Object.hpp:355
bool hasAurasWithId(uint32_t auraId) const
Definition Unit.cpp:5004
Aura * getAuraWithAuraSlot(uint16_t auraSlot) const
Definition Unit.cpp:4944
void removeAllAurasById(uint32_t auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
Definition Unit.cpp:5248
void getZoneAndAreaId(uint32_t phaseMask, uint32_t &zoneid, uint32_t &areaid, LocationVector const &pos)
@ TOTAL_SLOT_START
Definition AuraSlots.hpp:51
static const float _minY
static const float _maxY
static const float _minX
static const float _maxX
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _eventAttack()

void Player::_eventAttack ( bool  offhand)
protected

Definition at line 13615 of file Player.cpp.

13616{
13617 if (isCastingSpell())
13618 {
13619 setAttackTimer(offhand == true ? OFFHAND : MELEE, 100);
13620 return;
13621 }
13622
13623 if (isFeared() || isStunned())
13624 return;
13625
13626 Unit* pVictim = nullptr;
13627 if (getTargetGuid())
13628 pVictim = getWorldMap()->getUnit(getTargetGuid());
13629
13630 if (!pVictim)
13631 {
13632 sLogger.info("Player::Update: No valid current selection to attack, stopping attack");
13633 interruptHealthRegeneration(5000); //prevent clicking off creature for a quick heal
13635 return;
13636 }
13637
13638 if (!this->isValidTarget(pVictim))
13639 {
13642 return;
13643 }
13644
13645 if (!canReachWithAttack(pVictim))
13646 {
13647 if (m_AttackMsgTimer != 1)
13648 {
13649#if VERSION_STRING < Mop
13650 sendPacket(SmsgAttackSwingNotInRange().serialise().get());
13651#endif
13652 m_AttackMsgTimer = 1;
13653 }
13654 setAttackTimer(offhand == true ? OFFHAND : MELEE, 300);
13655 }
13656 else if (!isInFront(pVictim))
13657 {
13658 // We still have to do this one.
13659 if (m_AttackMsgTimer != 2)
13660 {
13661#if VERSION_STRING < Mop
13662 sendPacket(SmsgAttackSwingBadFacing().serialise().get());
13663#endif
13664 m_AttackMsgTimer = 2;
13665 }
13666 setAttackTimer(offhand == true ? OFFHAND : MELEE, 300);
13667 }
13668 else
13669 {
13670 m_AttackMsgTimer = 0;
13671
13672 // Set to weapon time.
13673 if (offhand)
13675 else
13677
13678 //pvp timeout reset
13679 if (pVictim->isPlayer())
13680 {
13681 if (static_cast<Player*>(pVictim)->m_cannibalize)
13682 {
13683 sEventMgr.RemoveEvents(pVictim, EVENT_CANNIBALIZE);
13685 static_cast<Player*>(pVictim)->m_cannibalize = false;
13686 }
13687 }
13688
13689 if (this->isStealthed())
13691
13692 if (getOnMeleeSpell() == 0 || offhand)
13693 strike(pVictim, (offhand ? OFFHAND : MELEE), nullptr, 0, 0, 0, false, false);
13694 else
13696 }
13697}
@ SPELL_AURA_MOD_STEALTH
@ EVENT_CANNIBALIZE
Definition EventMgr.h:48
#define sEventMgr
Definition EventMgr.h:278
#define false
Definition StormPort.h:33
@ EMOTE_ONESHOT_NONE
@ MELEE
@ OFFHAND
bool isValidTarget(Object *target, SpellInfo const *bySpell=nullptr)
Definition Object.cpp:4073
bool isInFront(Object *target)
Definition Object.cpp:3766
bool isCastingSpell(bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false) const
Definition Object.cpp:735
bool isPlayer() const
Definition Object.cpp:569
void sendPacket(WorldPacket *packet) override
Definition Player.cpp:3161
void eventAttackStop()
Definition Player.cpp:13776
uint32_t m_AttackMsgTimer
Definition Player.hpp:2208
bool m_cannibalize
Definition Player.hpp:2095
Definition Unit.hpp:147
void setEmoteState(uint32_t id)
Definition Unit.cpp:1446
void interruptHealthRegeneration(uint32_t timeInMS)
Definition Unit.cpp:6653
uint32_t isStunned() const
Definition Unit.hpp:1351
uint64_t getTargetGuid() const
Definition Unit.cpp:400
uint32_t getOnMeleeSpell() const
Definition Unit.hpp:1334
uint32_t getBaseAttackTime(uint8_t slot) const
Definition Unit.cpp:1233
void setAttackTimer(WeaponDamageType type, uint32_t time)
Definition Unit.cpp:6902
void castOnMeleeSpell()
Definition Unit.cpp:9383
void removeAllAurasByAuraEffect(AuraEffect effect, uint32_t skipSpell=0, bool removeOnlyEffect=false, uint64_t casterGuid=0, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
Definition Unit.cpp:5306
bool isStealthed() const
Definition Unit.cpp:6205
uint32_t isFeared() const
Definition Unit.hpp:1354
DamageInfo strike(Unit *pVictim, WeaponDamageType weaponType, SpellInfo const *ability, int32_t add_damage, int32_t pct_dmg_mod, uint32_t exclusive_damage, bool disable_proc, bool skip_hit_check, bool force_crit=false, Spell *castingSpell=nullptr)
Definition Unit.cpp:10407
bool canReachWithAttack(Unit *unitTarget)
Definition Unit.cpp:1831
Unit * getUnit(const uint64_t &guid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _loadPet()

void Player::_loadPet ( QueryResult result)
protected

Definition at line 14017 of file Player.cpp.

14018{
14019 m_maxPetNumber = 0;
14020 if (!result)
14021 return;
14022
14023 do
14024 {
14025 Field* fields = result->Fetch();
14026
14027 auto pet = std::make_unique<PetCache>();
14028 pet->number = fields[1].asUint8();
14029 pet->type = fields[2].asUint8();
14030 pet->name = fields[3].asCString();
14031 pet->entry = fields[4].asUint32();
14032
14033 // Check that creature properties exist
14034 const auto creatureProperties = sMySQLStore.getCreatureProperties(pet->entry);
14035 if (creatureProperties == nullptr)
14036 continue;
14037
14038 pet->model = fields[5].asUint32();
14039 pet->level = fields[6].asUint32();
14040 pet->xp = fields[7].asUint32();
14041 pet->slot = fields[8].asUint8();
14042 pet->active = fields[9].asBool();
14043 pet->alive = fields[10].asBool();
14044 pet->actionbar = fields[11].asCString();
14045 pet->reset_time = fields[12].asUint32();
14046 pet->reset_cost = fields[13].asUint32();
14047 pet->spellid = fields[14].asUint32();
14048 pet->petstate = fields[15].asUint8();
14049 pet->talentpoints = fields[16].asUint32();
14050 pet->current_power = fields[17].asUint32();
14051 pet->current_hp = fields[18].asUint32();
14052 pet->current_happiness = fields[19].asUint32();
14053 pet->renamable = fields[20].asBool();
14054
14055 // Check if there are pets using same slot
14056 // Also check for invalid pet slot in classic - wotlk
14057 // Could happen when server changes from cata to wotlk
14058 if (m_cachedPetSlots.contains(pet->slot)
14059#if VERSION_STRING < Cata
14060 || (pet->slot >= PET_SLOT_MAX_ACTIVE_SLOT && pet->slot < PET_SLOT_FIRST_STABLE_SLOT)
14061#endif
14062 )
14063 {
14064 if (pet->type != PET_TYPE_HUNTER)
14065 {
14066 // If other than hunter pet has invalid slot or is in duplicate slot, just remove it
14067 // They can be resummoned anyway
14068 continue;
14069 }
14070
14071#if VERSION_STRING >= Cata
14072 auto foundNewSlot = false;
14073 if (pet->slot < PET_SLOT_FIRST_STABLE_SLOT)
14074 {
14075 // Pet is in active slot, try find another active slot
14076 const auto freeActiveSlot = findFreeActivePetSlot();
14077 if (freeActiveSlot.has_value())
14078 {
14079 pet->slot = freeActiveSlot.value();
14080 foundNewSlot = true;
14081 }
14082 }
14083
14084 if (!foundNewSlot)
14085#endif
14086 {
14087 // Next try find free stable slot
14088 const auto freeStableSlot = findFreeStablePetSlot();
14089 if (!freeStableSlot.has_value())
14090 {
14091 // There were no free slots left, remove pet
14092 continue;
14093 }
14094
14095 pet->slot = freeStableSlot.value();
14096 }
14097 }
14098
14099 if (pet->type != PET_TYPE_HUNTER)
14100 {
14101 // Skip dead or inactive summoned pets
14102 // They should not be saved anyway
14103 if (!pet->active || !pet->alive)
14104 continue;
14105 }
14106
14107 // Pet in stables cannot be active
14108 if (pet->slot >= PET_SLOT_FIRST_STABLE_SLOT && pet->active)
14109 pet->active = false;
14110
14111 if (pet->number > m_maxPetNumber)
14112 m_maxPetNumber = pet->number;
14113
14114 addPetCache(std::move(pet), pet->number);
14115 } while (result->NextRow());
14116}
#define sMySQLStore
@ PET_TYPE_HUNTER
@ PET_SLOT_FIRST_STABLE_SLOT
@ PET_SLOT_MAX_ACTIVE_SLOT
uint8_t asUint8(bool _silencedError=false) const
Definition Field.cpp:18
const char * asCString() const
Definition Field.cpp:13
bool asBool() const
Definition Field.cpp:16
uint32_t asUint32(bool _silencedError=false) const
Definition Field.cpp:24
std::optional< uint8_t > findFreeActivePetSlot() const
Definition Player.cpp:12349
std::optional< uint8_t > findFreeStablePetSlot() const
Definition Player.cpp:12363
std::map< uint8_t, uint8_t > m_cachedPetSlots
Definition Player.hpp:1803
void addPetCache(std::unique_ptr< PetCache > petCache, uint8_t index)
Definition Player.cpp:12304
uint8_t m_maxPetNumber
Definition Player.hpp:1809
Field * Fetch()
Definition Database.h:195
virtual bool NextRow()=0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _loadPetSpells()

void Player::_loadPetSpells ( QueryResult result)
protected

Definition at line 14118 of file Player.cpp.

14119{
14120 if (result)
14121 {
14122 do
14123 {
14124 Field* fields = result->Fetch();
14125 uint32_t entry = fields[1].asUint32();
14126 uint32_t spell = fields[2].asUint32();
14127 addSummonSpell(entry, spell);
14128 } while (result->NextRow());
14129 }
14130}
void addSummonSpell(uint32_t entry, uint32_t spellId)
Definition Player.cpp:13969
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _loadPlayerCooldowns()

void Player::_loadPlayerCooldowns ( QueryResult result)
protected

Definition at line 4627 of file Player.cpp.

4628{
4629 if (result == nullptr)
4630 return;
4631
4632 uint32_t mstime = Util::getMSTime();
4633
4634 do
4635 {
4636 uint32_t type = result->Fetch()[0].asUint32();
4637 uint32_t misc = result->Fetch()[1].asUint32();
4638 uint32_t rtime = result->Fetch()[2].asUint32();
4639 uint32_t spellid = result->Fetch()[3].asUint32();
4640 uint32_t itemid = result->Fetch()[4].asUint32();
4641
4642 if (type >= NUM_COOLDOWN_TYPES)
4643 continue;
4644
4645 if ((uint32_t)UNIXTIME > rtime)
4646 continue;
4647
4648 rtime -= (uint32_t)UNIXTIME;
4649
4650 if (rtime < 10)
4651 continue;
4652
4653 uint32_t realtime = mstime + ((rtime) * 1000);
4654
4655 // apply it back into cooldown map
4656 PlayerCooldown playerCooldown;
4657 playerCooldown.ExpireTime = realtime;
4658 playerCooldown.ItemId = itemid;
4659 playerCooldown.SpellId = spellid;
4660 m_cooldownMap[type].insert(std::make_pair(misc, playerCooldown));
4661
4662 } while (result->NextRow());
4663}
@ NUM_COOLDOWN_TYPES
SERVER_DECL time_t UNIXTIME
Definition Log.cpp:17
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _loadQuestLogEntry()

void Player::_loadQuestLogEntry ( QueryResult result)
protected

Definition at line 15297 of file Player.cpp.

15298{
15299 for (uint8_t slot = 0; slot < MAX_QUEST_SLOT; ++slot)
15300 {
15301 setQuestLogEntryBySlot(slot, 0);
15302 setQuestLogStateBySlot(slot, 0);
15305 }
15306
15307 if (result)
15308 {
15309 do
15310 {
15311 Field* fields = result->Fetch();
15312 uint32_t questid = fields[1].asUint32();
15313 uint8_t slot = fields[2].asUint8();
15314
15315 QuestProperties const* questProperties = sMySQLStore.getQuestProperties(questid);
15316 if (!questProperties)
15317 {
15318 m_removequests.insert(questid);
15319 continue;
15320 }
15321
15322 if (m_questlog[slot] != nullptr)
15323 continue;
15324
15325 auto* questLogEntry = createQuestLogInSlot(questProperties, slot);
15326 questLogEntry->loadFromDB(fields);
15327 questLogEntry->updatePlayerFields();
15328
15329 } while (result->NextRow());
15330 }
15331}
#define MAX_QUEST_SLOT
void setQuestLogExpireTimeBySlot(uint8_t slot, uint32_t expireTime)
Definition Player.cpp:917
void setQuestLogEntryBySlot(uint8_t slot, uint32_t questEntry)
Definition Player.cpp:878
std::set< uint32_t > m_removequests
Definition Player.hpp:1526
QuestLogEntry * createQuestLogInSlot(QuestProperties const *questProperties, uint8_t slotId)
Definition Player.cpp:8818
void setQuestLogStateBySlot(uint8_t slot, uint32_t state)
Definition Player.cpp:890
void setQuestLogRequiredMobOrGoBySlot(uint8_t slot, uint32_t mobOrGoCount)
Definition Player.cpp:902
unsigned char uint8_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _Relocate()

void Player::_Relocate ( uint32_t  mapid,
const LocationVector v,
bool  sendpending,
bool  force_new_world,
uint32_t  instance_id 
)

Definition at line 15954 of file Player.cpp.

15955{
15956 // this func must only be called when switching between maps!
15957 if (sendpending && mapid != m_mapId && force_new_world)
15958 m_session->SendPacket(SmsgTransferPending(mapid).serialise().get());
15959
15960 bool sendpacket = (mapid == m_mapId);
15961 // Dismount before teleport and before being removed from world,
15962 // otherwise we may spawn the active pet while not being in world.
15963 dismount(false);
15964
15965 MySQLStructure::AreaTrigger const* areaTrigger = nullptr;
15966 bool check = false;
15967
15968 if (!sendpacket || force_new_world)
15969 {
15970 WorldMap* map = sMapMgr.createMap(mapid, this, instance_id);
15971 if (!map)
15972 {
15974 return;
15975 }
15976 else if (map->getBaseMap()->isInstanceMap())
15977 {
15978 if (auto state = map->cannotEnter(this))
15979 {
15980 switch (state)
15981 {
15984 break;
15986 m_session->systemMessage("Another group is already inside this instance of the dungeon.");
15987 break;
15990 break;
15992 m_session->SendPacket(SmsgTransferAborted(mapid, INSTANCE_ABORT_FULL).serialise().get());
15993 break;
15996 break;
15997 default:
15998 break;
15999 }
16000 areaTrigger = sMySQLStore.getMapGoBackTrigger(mapid);
16001 check = true;
16002 }
16003 else if (instance_id && !sInstanceMgr.getInstanceSave(instance_id)) // ... and instance is reseted then look for entrance.
16004 {
16005 areaTrigger = sMySQLStore.getMapEntranceTrigger(mapid);
16006 check = true;
16007 }
16008 }
16009
16010 // Special Cases
16011 if (check)
16012 {
16013 if (areaTrigger)
16014 {
16015 // our Instance got reset, port us to the entrance
16016 sendTeleportAckPacket(LocationVector(areaTrigger->x, areaTrigger->y, areaTrigger->z, areaTrigger->o));
16017 if (mapid != areaTrigger->mapId)
16018 {
16019 mapid = areaTrigger->mapId;
16020 map = sMapMgr.createMap(mapid, this);
16021 }
16022 }
16023 else
16024 {
16025 return;
16026 }
16027 }
16028
16029 if (IsInWorld())
16031
16032 m_session->SendPacket(SmsgNewWorld(mapid, v).serialise().get());
16033
16034 SetMapId(mapid);
16035 SetInstanceID(map->getInstanceId());
16036 }
16037 else
16038 {
16040 }
16041
16044 SetPosition(v);
16045
16046 if (sendpacket)
16048
16050
16051 m_zAxisPosition = 0.0f;
16052}
@ CANNOT_ENTER_MAX_PLAYERS
@ CANNOT_ENTER_TOO_MANY_INSTANCES
@ CANNOT_ENTER_ENCOUNTER
@ CANNOT_ENTER_INSTANCE_BIND_MISMATCH
@ CANNOT_ENTER_DIFFICULTY_UNAVAILABLE
@ INSTANCE_ABORT_FULL
@ INSTANCE_ABORT_ENCOUNTER
@ INSTANCE_ABORT_HEROIC_MODE_NOT_AVAILABLE
@ INSTANCE_ABORT_TOO_MANY
@ INSTANCE_ABORT_NOT_FOUND
#define sInstanceMgr
#define sMapMgr
Definition MapMgr.hpp:91
@ TRANSFER_PENDING
static const unsigned char map[256]
void SetInstanceID(int32_t instance)
Definition Object.hpp:663
uint32_t m_mapId
Definition Object.hpp:734
bool SetPosition(float newX, float newY, float newZ, float newOrientation, bool allowPorting=false)
Definition Object.cpp:3354
void SetMapId(uint32_t newMap)
Definition Object.hpp:464
void speedCheatReset()
Definition Player.cpp:9374
void setTransferStatus(uint8_t status)
Definition Player.cpp:1889
void removeFromWorld()
Definition Player.cpp:712
void sendTeleportAckPacket(LocationVector position)
Definition Player.cpp:1957
void sendTeleportPacket(LocationVector position)
Definition Player.cpp:1895
float m_zAxisPosition
Definition Unit.hpp:612
void dismount(bool resummonPet=true)
Definition Unit.cpp:8602
void systemMessage(const std::string &format, Args &&... args)
static void check(LexState *ls, int c)
Definition lparser.c:107
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _removeSpell()

bool Player::_removeSpell ( uint32_t  spellId,
bool  moveToDeleted,
bool  silently = false,
bool  removingPreviousRank = false,
bool  forceRemoveHigherRanks = false 
)
private

Definition at line 5594 of file Player.cpp.

5595{
5596 const auto itr = std::as_const(m_spellSet).find(spellId);
5597 if (itr == m_spellSet.cend())
5598 {
5599 // When resetting talents if player can know single rank of this spell and the first rank is a talent,
5600 // other ranks are never removed since player does not have first rank active anymore
5601 if (forceRemoveHigherRanks)
5602 {
5603 const auto* const spellInfo = sSpellMgr.getSpellInfo(spellId);
5604 if (spellInfo == nullptr || !spellInfo->hasSpellRanks() || !spellInfo->canKnowOnlySingleRank())
5605 return false;
5606
5607 const auto* higherRankInfo = spellInfo->getRankInfo()->getNextSpell();
5608 while (higherRankInfo != nullptr)
5609 {
5610 if (_removeSpell(higherRankInfo->getId(), true, silently, true))
5611 {
5612 // Removed a higher ranked spell from single rank chain, safe to exit
5613 return true;
5614 }
5615
5616 higherRankInfo = higherRankInfo->getRankInfo()->getNextSpell();
5617 }
5618 }
5619
5620 return false;
5621 }
5622
5623 m_spellSet.erase(itr);
5625
5626 if (moveToDeleted)
5627 m_deletedSpellSet.emplace(spellId);
5628
5629 const auto* const spellInfo = sSpellMgr.getSpellInfo(spellId);
5630 auto activatedPreviousRank = false;
5631 if (spellInfo->hasSpellRanks())
5632 {
5633 // If player can know single rank of this spell rank chain, activate previous rank in spell map
5634 if (!removingPreviousRank && spellInfo->canKnowOnlySingleRank())
5635 {
5636 const auto* previousSpell = spellInfo->getRankInfo()->getPreviousSpell();
5637 while (previousSpell != nullptr)
5638 {
5639 if (hasDeletedSpell(previousSpell->getId()))
5640 {
5641 _addSpell(previousSpell->getId(), 0, true, true);
5642 activatedPreviousRank = true;
5643 break;
5644 }
5645 previousSpell = previousSpell->getRankInfo()->getPreviousSpell();
5646 }
5647
5648 if (IsInWorld() && !silently && activatedPreviousRank)
5649 getSession()->SendPacket(SmsgSupercededSpell(spellId, previousSpell->getId()).serialise().get());
5650 }
5651 }
5652
5653 for (uint8_t i = 0; i < MAX_SPELL_EFFECTS; ++i)
5654 {
5655 const auto spellEff = spellInfo->getEffect(i);
5656 if (spellEff == SPELL_EFFECT_NULL)
5657 continue;
5658
5659 switch (spellEff)
5660 {
5662 // If spell teaches another spell, remove it recursively as well
5663 if (const auto taughtSpellId = spellInfo->getEffectTriggerSpell(i))
5664 _removeSpell(taughtSpellId, false, false, true);
5665 break;
5667 setDualWield(false);
5668 break;
5670 applyItemProficienciesFromSpell(spellInfo, false);
5671 break;
5673 if (const auto triggerSpellId = spellInfo->getEffectTriggerSpell(i))
5674 removeAllAurasByIdForGuid(triggerSpellId, getGuid());
5675 break;
5676#if VERSION_STRING >= WotLK
5678 setDualWield2H(false);
5679 break;
5680#endif
5681 default:
5682 break;
5683 }
5684 }
5685
5686 if (IsInWorld() && !silently && !activatedPreviousRank)
5687 getSession()->SendPacket(SmsgRemovedSpell(spellId).serialise().get());
5688
5689 if (spellInfo->hasSpellRanks())
5690 {
5691 // Remove higher ranks from spell map as well
5692 if (const auto* const nextSpell = spellInfo->getRankInfo()->getNextSpell())
5693 _removeSpell(nextSpell->getId(), true, false, true);
5694 }
5695
5696 return true;
5697}
@ SPELL_EFFECT_PROFICIENCY
@ SPELL_EFFECT_TRIGGER_SPELL
@ SPELL_EFFECT_DUAL_WIELD_2H
@ SPELL_EFFECT_NULL
@ SPELL_EFFECT_DUAL_WIELD
static constexpr uint8_t MAX_SPELL_EFFECTS
void setDualWield2H(bool enable)
Definition Player.cpp:4266
SpellSet m_deletedSpellSet
Definition Player.hpp:969
bool hasDeletedSpell(uint32_t spellId) const
Definition Player.cpp:3930
void applyItemProficienciesFromSpell(SpellInfo const *spellInfo, bool apply)
Definition Player.cpp:5253
void removeAllAurasByIdForGuid(uint32_t auraId, uint64_t guid, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
Definition Unit.cpp:5274
void setDualWield(bool enable)
Definition Unit.cpp:3542
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _savePet()

void Player::_savePet ( QueryBuffer buf,
bool  updateCurrentPetCache = false,
Pet currentPet = nullptr 
)
protected

Definition at line 13794 of file Player.cpp.

13795{
13796 // Remove any existing m_playerCreateInfo
13797 if (buf == nullptr)
13798 CharacterDatabase.Execute("DELETE FROM playerpets WHERE ownerguid = %u", getGuidLow());
13799 else
13800 buf->AddQuery("DELETE FROM playerpets WHERE ownerguid = %u", getGuidLow());
13801
13802 const auto* summon = currentPet != nullptr ? currentPet : getPet();
13803 if (summon && summon->IsInWorld()) // update PlayerPets array with current pet's m_playerCreateInfo
13804 {
13805 if (updateCurrentPetCache)
13806 {
13807 const auto playerPetCache = getPetCache(summon->getPetId());
13808 if (playerPetCache != nullptr && playerPetCache->active)
13809 summon->updatePetInfo(false);
13810 else
13811 summon->updatePetInfo(true);
13812 }
13813
13814 if (summon->isHunterPet()) // is a pet
13815 {
13816 // save pet spellz
13817 auto pn = summon->getPetId();
13818 if (buf == nullptr)
13819 CharacterDatabase.Execute("DELETE FROM playerpetspells WHERE ownerguid=%u AND petnumber=%u", getGuidLow(), pn);
13820 else
13821 buf->AddQuery("DELETE FROM playerpetspells WHERE ownerguid=%u AND petnumber=%u", getGuidLow(), pn);
13822
13823 for (const auto& [spell, state] : summon->getSpellMap())
13824 {
13825 if (buf == nullptr)
13826 CharacterDatabase.Execute("INSERT INTO playerpetspells VALUES(%u, %u, %u, %u)", getGuidLow(), pn, spell, state);
13827 else
13828 buf->AddQuery("INSERT INTO playerpetspells VALUES(%u, %u, %u, %u)", getGuidLow(), pn, spell, state);
13829 }
13830 }
13831 }
13832
13833 std::stringstream ss;
13834
13835 ss.rdbuf()->str("");
13836
13837 std::optional<uint8_t> currentPetId = std::nullopt;
13838 if (getPet() != nullptr && getPet()->isPermanentSummon())
13839 currentPetId = getPet()->getPetId();
13840
13841 std::vector<uint8_t> savedPetIds;
13842 savedPetIds.reserve(m_cachedPets.size());
13843
13844 auto foundActivePet = false;
13845 for (auto itr = m_cachedPets.cbegin(); itr != m_cachedPets.cend();)
13846 {
13847 auto* petCache = itr->second.get();
13848
13849 // Do some clean up to pet cache before save
13850 if (currentPetId.has_value())
13851 {
13852 // Set all other pets expect current pet to offline
13853 if (petCache->active && petCache->number != currentPetId.value())
13854 petCache->active = false;
13855
13856 // Remove all other cached pets from non-hunters expect current pet
13857 if (!isClassHunter() && getPetCount() > 1)
13858 {
13859 if (petCache->number != currentPetId.value())
13860 {
13861 std::erase_if(m_cachedPetSlots, [&petCache](const auto& slotItr) { return slotItr.second == petCache->number; });
13862 itr = m_cachedPets.erase(itr);
13863 continue;
13864 }
13865 }
13866 }
13867 else
13868 {
13869 // There can be only one active pet
13870 if (petCache->active)
13871 {
13872 if (petCache->slot >= PET_SLOT_FIRST_STABLE_SLOT)
13873 petCache->active = false;
13874 else if (foundActivePet)
13875 petCache->active = false;
13876 else
13877 foundActivePet = true;
13878 }
13879
13880 // Only hunters can have multiple pets saved
13881 if (!isClassHunter() && getPetCount() > 1)
13882 {
13883 if (!petCache->active)
13884 {
13885 std::erase_if(m_cachedPetSlots, [&petCache](const auto& slotItr) { return slotItr.second == petCache->number; });
13886 itr = m_cachedPets.erase(itr);
13887 continue;
13888 }
13889 }
13890 }
13891
13892 ss.rdbuf()->str("");
13893
13894 ss << "REPLACE INTO playerpets VALUES('"
13895 << getGuidLow() << "','"
13896 << std::to_string(petCache->number) << "','"
13897 << std::to_string(petCache->type) << "','"
13898 << petCache->name << "','"
13899 << petCache->entry << "','"
13900 << petCache->model << "','"
13901 << petCache->level << "','"
13902 << petCache->xp << "','"
13903 << std::to_string(petCache->slot) << "','"
13904 << petCache->active << "','"
13905 << petCache->alive << "','"
13906 << petCache->actionbar << "','"
13907 << static_cast<long>(petCache->reset_time) << "','"
13908 << petCache->reset_cost << "','"
13909 << petCache->spellid << "','"
13910 << std::to_string(petCache->petstate) << "','"
13911 << petCache->talentpoints << "','"
13912 << petCache->current_power << "','"
13913 << petCache->current_hp << "','"
13914 << petCache->current_happiness << "','"
13915 << petCache->renamable << "')";
13916
13917 if (buf == nullptr)
13918 CharacterDatabase.ExecuteNA(ss.str().c_str());
13919 else
13920 buf->AddQueryStr(ss.str());
13921
13922 savedPetIds.push_back(petCache->number);
13923 ++itr;
13924 }
13925
13926 // Cleanup as well pet spell table by removing spells from non existant pets
13927 ss.rdbuf()->str("");
13928 ss << "DELETE FROM playerpetspells WHERE ownerguid=" << getGuidLow();
13929 if (!savedPetIds.empty())
13930 {
13931 ss << " AND petnumber NOT IN (";
13932 for (auto itr = savedPetIds.cbegin(); itr != savedPetIds.cend();)
13933 {
13934 ss << std::to_string(*itr);
13935 if (++itr != savedPetIds.cend())
13936 ss << ", ";
13937 else
13938 ss << ")";
13939 }
13940 }
13941
13942 if (buf == nullptr)
13943 CharacterDatabase.ExecuteNA(ss.str().c_str());
13944 else
13945 buf->AddQueryStr(ss.str());
13946}
#define CharacterDatabase
uint32_t getGuidLow() const
Definition Object.cpp:304
uint8_t getPetId() const
Definition Pet.cpp:456
uint8_t getPetCount() const
Definition Player.cpp:12323
PetCache const * getPetCache(uint8_t petId) const
Definition Player.cpp:12276
virtual bool isClassHunter() const
Definition Player.cpp:2767
char buf[N_BUF]
Definition spewG.c:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _savePetSpells()

void Player::_savePetSpells ( QueryBuffer buf)
protected

Definition at line 13948 of file Player.cpp.

13949{
13950 // Remove any existing
13951 if (buf == nullptr)
13952 CharacterDatabase.Execute("DELETE FROM playersummonspells WHERE ownerguid=%u", getGuidLow());
13953 else
13954 buf->AddQuery("DELETE FROM playersummonspells WHERE ownerguid=%u", getGuidLow());
13955
13956 // Save summon spells
13957 for (std::map<uint32_t, std::set<uint32_t> >::iterator itr = m_summonSpells.begin(); itr != m_summonSpells.end(); ++itr)
13958 {
13959 for (std::set<uint32_t>::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
13960 {
13961 if (buf == nullptr)
13962 CharacterDatabase.Execute("INSERT INTO playersummonspells VALUES(%u, %u, %u)", getGuidLow(), itr->first, (*it));
13963 else
13964 buf->AddQuery("INSERT INTO playersummonspells VALUES(%u, %u, %u)", getGuidLow(), itr->first, (*it));
13965 }
13966 }
13967}
std::map< uint32_t, std::set< uint32_t > > m_summonSpells
Definition Player.hpp:2163
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _savePlayerCooldowns()

void Player::_savePlayerCooldowns ( QueryBuffer buf)
protected

Definition at line 4665 of file Player.cpp.

4666{
4667 uint32_t mstime = Util::getMSTime();
4668
4669 if (buf != nullptr)
4670 buf->AddQuery("DELETE FROM playercooldowns WHERE player_guid = %u", getGuidLow());
4671 else
4672 CharacterDatabase.Execute("DELETE FROM playercooldowns WHERE player_guid = %u", getGuidLow());
4673
4674 for (uint32_t index = 0; index < NUM_COOLDOWN_TYPES; ++index)
4675 {
4676 for (PlayerCooldownMap::iterator cooldownItr = m_cooldownMap[index].begin(); cooldownItr != m_cooldownMap[index].end();)
4677 {
4678 PlayerCooldownMap::iterator nextCooldownItr = cooldownItr++;
4679
4680 if (mstime >= nextCooldownItr->second.ExpireTime)
4681 {
4682 m_cooldownMap[index].erase(nextCooldownItr);
4683 continue;
4684 }
4685
4686 if ((nextCooldownItr->second.ExpireTime - mstime) < COOLDOWN_SKIP_SAVE_IF_MS_LESS_THAN)
4687 continue;
4688
4689 uint32_t seconds = (nextCooldownItr->second.ExpireTime - mstime) / 1000;
4690
4691 if (buf != nullptr)
4692 {
4693 buf->AddQuery("INSERT INTO playercooldowns VALUES(%u, %u, %u, %u, %u, %u)", getGuidLow(),
4694 index, nextCooldownItr->first, seconds + (uint32_t)UNIXTIME, nextCooldownItr->second.SpellId, nextCooldownItr->second.ItemId);
4695 }
4696 else
4697 {
4698 CharacterDatabase.Execute("INSERT INTO playercooldowns VALUES(%u, %u, %u, %u, %u, %u)", getGuidLow(),
4699 index, nextCooldownItr->first, seconds + (uint32_t)UNIXTIME, nextCooldownItr->second.SpellId, nextCooldownItr->second.ItemId);
4700 }
4701 }
4702 }
4703}
#define COOLDOWN_SKIP_SAVE_IF_MS_LESS_THAN
float seconds()
Definition units.h:97
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _saveQuestLogEntry()

void Player::_saveQuestLogEntry ( QueryBuffer buf)
protected

Definition at line 14481 of file Player.cpp.

14482{
14483 for (uint32_t removeableQuestId : m_removequests)
14484 {
14485 if (buf == nullptr)
14486 CharacterDatabase.Execute("DELETE FROM questlog WHERE player_guid=%u AND quest_id=%u", getGuidLow(), removeableQuestId);
14487 else
14488 buf->AddQuery("DELETE FROM questlog WHERE player_guid=%u AND quest_id=%u", getGuidLow(), removeableQuestId);
14489 }
14490
14491 m_removequests.clear();
14492
14493 for (auto& questlogEntry : m_questlog)
14494 {
14495 if (questlogEntry != nullptr)
14496 questlogEntry->saveToDB(buf);
14497 }
14498}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _spawnPet()

void Player::_spawnPet ( PetCache const petCache)
private

Definition at line 12707 of file Player.cpp.

12708{
12709 const auto pet = sObjectMgr.createPet(petCache->entry, nullptr);
12710 if (!pet->loadFromDB(this, petCache))
12711 {
12712 pet->DeleteMe();
12713 return;
12714 }
12715
12716 // TODO: find a better way to handle these -Appled
12717 if (petCache->spellid)
12718 {
12719 removeAllAurasById(18789);
12720 removeAllAurasById(18790);
12721 removeAllAurasById(18791);
12722 removeAllAurasById(18792);
12723 removeAllAurasById(35701);
12724 }
12725}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _updateSkillBonusFields()

void Player::_updateSkillBonusFields ( const PlayerSkillFieldPosition  fieldPosition,
uint16_t  tempBonus,
uint16_t  permBonus 
)
private

Definition at line 5800 of file Player.cpp.

5801{
5802#if VERSION_STRING < Cata
5803 // field 2
5804 setSkillInfoBonusTemporary(fieldPosition.index, tempBonus);
5805 setSkillInfoBonusPermanent(fieldPosition.index, permBonus);
5806#else
5807 // field 2
5808 setSkillInfoBonusTemporary(fieldPosition.field, fieldPosition.offset, tempBonus);
5809 setSkillInfoBonusPermanent(fieldPosition.field, fieldPosition.offset, permBonus);
5810#endif
5811}
void setSkillInfoBonusPermanent(uint32_t index, uint8_t offset, uint16_t bonus)
Definition Player.cpp:1026
void setSkillInfoBonusTemporary(uint32_t index, uint8_t offset, uint16_t bonus)
Definition Player.cpp:1025
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _updateSkillFieldOnValueChange()

void Player::_updateSkillFieldOnValueChange ( const PlayerSkillFieldPosition  fieldPosition,
uint16_t  skillStep,
uint16_t  currentValue,
uint16_t  maxValue 
)
private

Definition at line 5783 of file Player.cpp.

5784{
5785#if VERSION_STRING < Cata
5786 // field 0
5787 setSkillInfoStep(fieldPosition.index, skillStep);
5788 // field 1
5789 setSkillInfoCurrentValue(fieldPosition.index, currentValue);
5790 setSkillInfoMaxValue(fieldPosition.index, maxValue);
5791#else
5792 // field 0
5793 setSkillInfoStep(fieldPosition.field, fieldPosition.offset, skillStep);
5794 // field 1
5795 setSkillInfoCurrentValue(fieldPosition.field, fieldPosition.offset, currentValue);
5796 setSkillInfoMaxValue(fieldPosition.field, fieldPosition.offset, maxValue);
5797#endif
5798}
void setSkillInfoCurrentValue(uint32_t index, uint8_t offset, uint16_t current)
Definition Player.cpp:1023
void setSkillInfoStep(uint32_t index, uint8_t offset, uint16_t step)
Definition Player.cpp:1022
void setSkillInfoMaxValue(uint32_t index, uint8_t offset, uint16_t max)
Definition Player.cpp:1024
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _verifySkillValues() [1/2]

void Player::_verifySkillValues ( WDB::Structures::SkillLineEntry const skillEntry,
uint16_t currentValue,
uint16_t maxValue,
uint16_t skillStep 
)
private

Definition at line 5777 of file Player.cpp.

5778{
5779 auto requireUpdate = false;
5780 _verifySkillValues(skillEntry, currentValue, maxValue, skillStep, &requireUpdate);
5781}
void _verifySkillValues(WDB::Structures::SkillLineEntry const *skillEntry, uint16_t *currentValue, uint16_t *maxValue, uint16_t *skillStep, bool *requireUpdate)
Definition Player.cpp:5700
Here is the call graph for this function:

◆ _verifySkillValues() [2/2]

void Player::_verifySkillValues ( WDB::Structures::SkillLineEntry const skillEntry,
uint16_t currentValue,
uint16_t maxValue,
uint16_t skillStep,
bool requireUpdate 
)
private

Definition at line 5700 of file Player.cpp.

5701{
5702 auto level_bound_skill = skillEntry->type == SKILL_TYPE_WEAPON && skillEntry->id != SKILL_DUAL_WIELD;
5703#if VERSION_STRING <= WotLK
5704 level_bound_skill = level_bound_skill || skillEntry->id == SKILL_LOCKPICKING;
5705#endif
5706#if VERSION_STRING <= TBC
5707 level_bound_skill = level_bound_skill || skillEntry->id == SKILL_POISONS;
5708#endif
5709
5710 uint16_t newMaximum = 0;
5711 auto isCurrentValueMaxed = false;
5712 *requireUpdate = false;
5713
5714 if (level_bound_skill)
5715 {
5716 newMaximum = static_cast<uint16_t>(5 * getLevel());
5717#if VERSION_STRING >= Cata
5718 // In cata all weapon skills are always maxed
5719 isCurrentValueMaxed = true;
5720#endif
5721 }
5722 else if (skillEntry->type == SKILL_TYPE_LANGUAGE)
5723 {
5724 newMaximum = 300;
5725 isCurrentValueMaxed = true;
5726 }
5727 else if (skillEntry->type == SKILL_TYPE_PROFESSION || skillEntry->type == SKILL_TYPE_SECONDARY)
5728 {
5729 newMaximum = *maxValue;
5730
5731 if (newMaximum == 0)
5732 {
5733 newMaximum = 75;
5734 while (newMaximum < *currentValue && newMaximum < DBC_PLAYER_SKILL_MAX)
5735 {
5736 newMaximum += 75;
5737 }
5738 }
5739
5740 if (skillEntry->id == SKILL_RIDING)
5741 isCurrentValueMaxed = true;
5742 }
5743 else
5744 {
5745 newMaximum = 1;
5746 isCurrentValueMaxed = true;
5747 }
5748
5749 // force to be within limits
5750 if (newMaximum > DBC_PLAYER_SKILL_MAX)
5751 newMaximum = DBC_PLAYER_SKILL_MAX;
5752
5753 if (*maxValue != newMaximum)
5754 {
5755 *requireUpdate = true;
5756 *maxValue = newMaximum;
5757 }
5758 if (*currentValue > newMaximum)
5759 {
5760 *requireUpdate = true;
5761 *currentValue = newMaximum;
5762 }
5763
5764 // These are at max value all the time
5765 if (isCurrentValueMaxed && *currentValue != newMaximum)
5766 {
5767 *requireUpdate = true;
5768 *currentValue = newMaximum;
5769 }
5770
5771 if (skillEntry->type == SKILL_TYPE_PROFESSION || skillEntry->type == SKILL_TYPE_SECONDARY)
5772 *skillStep = *maxValue / 75U;
5773 else
5774 *skillStep = 0;
5775}
#define DBC_PLAYER_SKILL_MAX
@ SKILL_POISONS
Definition Skill.hpp:22
@ SKILL_DUAL_WIELD
Definition Skill.hpp:45
@ SKILL_RIDING
Definition Skill.hpp:163
@ SKILL_LOCKPICKING
Definition Skill.hpp:151
@ SKILL_TYPE_SECONDARY
Definition Skill.hpp:282
@ SKILL_TYPE_LANGUAGE
Definition Skill.hpp:283
@ SKILL_TYPE_PROFESSION
Definition Skill.hpp:284
@ SKILL_TYPE_WEAPON
Definition Skill.hpp:279
uint32_t getLevel() const
Definition Unit.cpp:936
Here is the call graph for this function:
Here is the caller graph for this function:

◆ acceptQuest()

void Player::acceptQuest ( uint64_t  guid,
uint32_t  quest_id 
)

Definition at line 8642 of file Player.cpp.

8643{
8644 bool bValid = false;
8645 bool hasquest = true;
8646 bool bSkipLevelCheck = false;
8647
8648 QuestProperties const* questProperties = nullptr;
8649
8650 Object* qst_giver = nullptr;
8651
8652 WoWGuid wowGuid;
8653 wowGuid.Init(guid);
8654
8655 if (wowGuid.isUnit())
8656 {
8657 Creature* quest_giver = m_WorldMap->getCreature(wowGuid.getGuidLowPart());
8658 if (quest_giver)
8659 qst_giver = quest_giver;
8660 else
8661 return;
8662
8663 hasquest = quest_giver->HasQuest(quest_id, 1);
8664 if (quest_giver->isQuestGiver())
8665 {
8666 bValid = true;
8667 questProperties = sMySQLStore.getQuestProperties(quest_id);
8668 }
8669 }
8670 else if (wowGuid.isGameObject())
8671 {
8672 GameObject* quest_giver = m_WorldMap->getGameObject(wowGuid.getGuidLowPart());
8673 if (quest_giver)
8674 qst_giver = quest_giver;
8675 else
8676 return;
8677
8678 bValid = true;
8679 questProperties = sMySQLStore.getQuestProperties(quest_id);
8680 }
8681 else if (wowGuid.isItem())
8682 {
8683 Item* quest_giver = getItemInterface()->GetItemByGUID(guid);
8684 if (quest_giver)
8685 qst_giver = quest_giver;
8686 else
8687 return;
8688
8689 bValid = true;
8690 bSkipLevelCheck = true;
8691 questProperties = sMySQLStore.getQuestProperties(quest_id);
8692 }
8693 else if (wowGuid.isPlayer())
8694 {
8695 Player* quest_giver = m_WorldMap->getPlayer(static_cast<uint32_t>(guid));
8696 if (quest_giver)
8697 qst_giver = quest_giver;
8698 else
8699 return;
8700
8701 bValid = true;
8702 questProperties = sMySQLStore.getQuestProperties(quest_id);
8703 }
8704
8705 if (!qst_giver)
8706 {
8707 sLogger.debug("WORLD: Invalid questgiver GUID.");
8708 return;
8709 }
8710
8711 if (!bValid || questProperties == nullptr)
8712 {
8713 sLogger.debug("WORLD: Creature is not a questgiver.");
8714 return;
8715 }
8716
8717 if (hasQuestInQuestLog(questProperties->id))
8718 return;
8719
8720 if (qst_giver->isCreature() && dynamic_cast<Creature*>(qst_giver)->m_escorter != nullptr)
8721 {
8722 m_session->SystemMessage("You cannot accept this quest at this time.");
8723 return;
8724 }
8725
8726 // Check the player hasn't already taken this quest, or it isn't available.
8727 const uint32_t status = sQuestMgr.CalcQuestStatus(qst_giver, this, questProperties, 3, bSkipLevelCheck);
8728
8729 if ((!sQuestMgr.IsQuestRepeatable(questProperties) && hasQuestFinished(questProperties->id))
8730 || (status != QuestStatus::Available && status != QuestStatus::Repeatable && status != QuestStatus::AvailableChat)
8731 || !hasquest)
8732 {
8733 return;
8734 }
8735
8736 const uint8_t log_slot = getFreeQuestSlot();
8737 if (log_slot > MAX_QUEST_SLOT)
8738 {
8739 sQuestMgr.SendQuestLogFull(this);
8740 return;
8741 }
8742
8743 if ((questProperties->time != 0) && hasTimedQuestInQuestSlot())
8744 {
8745 sQuestMgr.SendQuestInvalid(INVALID_REASON_HAVE_TIMED_QUEST, this);
8746 return;
8747 }
8748
8749 if (questProperties->count_receiveitems || questProperties->srcitem)
8750 {
8751 const uint32_t slots_required = questProperties->count_receiveitems;
8752
8753 if (getItemInterface()->CalculateFreeSlots(nullptr) < slots_required)
8754 {
8756 sQuestMgr.SendQuestFailed(FAILED_REASON_INV_FULL, questProperties, this);
8757 return;
8758 }
8759 }
8760
8761 auto* questLogEntry = createQuestLogInSlot(questProperties, log_slot);
8762 questLogEntry->updatePlayerFields();
8763
8764 // If the quest should give any items on begin, give them the items.
8765 for (uint32_t receive_item : questProperties->receive_items)
8766 {
8767 if (receive_item)
8768 {
8769 if (auto itemHolder = sObjectMgr.createItem(receive_item, this))
8770 {
8771 auto* item = itemHolder.get();
8772 const auto [addResult, _] = getItemInterface()->AddItemToFreeSlot(std::move(itemHolder));
8773 if (addResult == ADD_ITEM_RESULT_OK)
8774 {
8775 sendItemPushResultPacket(false, true, false,
8776 getItemInterface()->LastSearchItemBagSlot(), getItemInterface()->LastSearchItemSlot(),
8777 1, item->getEntry(), item->getPropertySeed(), item->getRandomPropertiesId(), item->getStackCount());
8778 }
8779 }
8780 }
8781 }
8782
8783 if (questProperties->srcitem && questProperties->srcitem != questProperties->receive_items[0])
8784 {
8785 if (!qst_giver->isItem() || (qst_giver->getEntry() != questProperties->srcitem))
8786 {
8787 if (auto item = sObjectMgr.createItem(questProperties->srcitem, this))
8788 {
8789 item->setStackCount(questProperties->srcitemcount ? questProperties->srcitemcount : 1);
8790 getItemInterface()->AddItemToFreeSlot(std::move(item));
8791 }
8792 }
8793 }
8794
8796
8797 const SpellAreaForQuestMapBounds saBounds = { sSpellMgr.mSpellAreaForQuestMap.lower_bound(quest_id), sSpellMgr.mSpellAreaForQuestMap.upper_bound(quest_id) };
8798 if (saBounds.first != saBounds.second)
8799 {
8800 for (auto itr = saBounds.first; itr != saBounds.second; ++itr)
8801 {
8802 if (itr->second->autoCast && itr->second->fitsToRequirements(this, getZoneId(), getAreaId()))
8803 if (!hasAurasWithId(itr->second->spellId))
8804 castSpell(this, itr->second->spellId, true);
8805 }
8806 }
8807
8808 sQuestMgr.OnQuestAccepted(this, questProperties, qst_giver);
8809
8810 // Hook to Creature Script
8811 if (qst_giver->ToCreature() && qst_giver->ToCreature()->GetScript())
8812 qst_giver->ToCreature()->GetScript()->onQuestAccept(this, questProperties);
8813
8814 sLogger.debug("WORLD: Added new QLE.");
8815 sHookInterface.OnQuestAccept(this, questProperties, qst_giver);
8816}
#define sHookInterface
@ ADD_ITEM_RESULT_OK
@ INV_ERR_BAG_FULL
@ INVALID_REASON_HAVE_TIMED_QUEST
@ FAILED_REASON_INV_FULL
#define sQuestMgr
Definition QuestMgr.h:252
std::pair< SpellAreaForQuestMap::const_iterator, SpellAreaForQuestMap::const_iterator > SpellAreaForQuestMapBounds
Definition SpellMgr.hpp:60
virtual void onQuestAccept(Player *, QuestProperties const *)
CreatureAIScript * GetScript()
bool HasQuest(uint32_t id, uint32_t type)
Player * m_escorter
Definition Creature.h:356
bool isQuestGiver() const
Definition Creature.cpp:257
void buildInventoryChangeError(Item const *srcItem, Item const *dstItem, uint8_t inventoryError, uint32_t srcItemId=0)
Item * GetItemByGUID(uint64_t itemGuid)
Gets a Item by guid.
std::tuple< AddItemResult, std::unique_ptr< Item > > AddItemToFreeSlot(std::unique_ptr< Item > item)
Adds a Item to a free slot.
Definition Item.hpp:43
const uint32_t & getAreaId() const
Definition Object.hpp:470
WorldMap * m_WorldMap
Definition Object.hpp:736
Creature * ToCreature()
Definition Object.hpp:393
bool isItem() const
Definition Object.cpp:571
uint32_t getEntry() const
Definition Object.cpp:382
bool isCreature() const
Definition Object.cpp:570
const uint32_t & getZoneId() const
Definition Object.hpp:469
ItemInterface * getItemInterface() const
Definition Player.cpp:6934
bool hasTimedQuestInQuestSlot() const
Definition Player.cpp:8898
uint8_t getFreeQuestSlot() const
Definition Player.cpp:8850
bool hasQuestFinished(uint32_t questId) const
Definition Player.cpp:8935
void sendItemPushResultPacket(bool created, bool recieved, bool sendtoset, uint8_t destbagslot, uint32_t destslot, uint32_t count, uint32_t entry, uint32_t suffix, uint32_t randomprop, uint32_t stack)
Definition Player.cpp:9724
bool hasQuestInQuestLog(uint32_t questId) const
Definition Player.cpp:8842
void updateNearbyQuestGameObjects()
Definition Player.cpp:9043
bool isItem() const
Definition WoWGuid.h:292
bool isGameObject() const
Definition WoWGuid.h:297
bool isUnit() const
Definition WoWGuid.h:299
bool isPlayer() const
Definition WoWGuid.h:290
uint32_t getGuidLowPart() const
Definition WoWGuid.h:222
void Init(uint64_t guid)
Definition WoWGuid.h:176
GameObject * getGameObject(uint32_t guid)
Creature * getCreature(uint32_t guid)
Player * getPlayer(uint32_t guid)
void SystemMessage(const char *format,...)
uint32_t receive_items[4]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ activateTalentSpec()

void Player::activateTalentSpec ( uint8_t  specId)

Definition at line 6237 of file Player.cpp.

6238{
6239#if VERSION_STRING < Mop
6240#ifndef FT_DUAL_SPEC
6241 return;
6242#else
6243 if (specId >= MAX_SPEC_COUNT || m_talentActiveSpec >= MAX_SPEC_COUNT || m_talentActiveSpec == specId)
6244 return;
6245
6246 // Dismiss current pet or set temporarily unsummoned pet offline
6247 if (getPet() != nullptr)
6248 getPet()->unSummon();
6249 else
6251
6252 // Reset action buttons on client
6253 sendActionBars(2);
6254
6255 // Remove old glyphs
6256 for (uint8_t i = 0; i < GLYPHS_COUNT; ++i)
6257 {
6258 const auto glyphProperties = sGlyphPropertiesStore.lookupEntry(m_specs[m_talentActiveSpec].getGlyph(i));
6259 if (glyphProperties != nullptr)
6260 removeAllAurasById(glyphProperties->SpellID);
6261 }
6262
6263 // Remove old talents and move them to deleted spells
6264 for (const auto& [talentId, rank] : m_specs[m_talentActiveSpec].getTalents())
6265 {
6266 const auto talentInfo = sTalentStore.lookupEntry(talentId);
6267 if (talentInfo != nullptr)
6268 _removeSpell(talentInfo->RankID[rank], true, false, true, true);
6269 }
6270
6271 m_talentActiveSpec = specId;
6272
6273 // Add new glyphs
6274 for (uint8_t i = 0; i < GLYPHS_COUNT; ++i)
6275 {
6276 const auto glyphProperties = sGlyphPropertiesStore.lookupEntry(m_specs[m_talentActiveSpec].getGlyph(i));
6277 if (glyphProperties != nullptr)
6278 castSpell(this, glyphProperties->SpellID, true);
6279 }
6280
6281 // Add new talents
6282 for (const auto& [talentId, rank] : m_specs[m_talentActiveSpec].getTalents())
6283 {
6284 const auto talentInfo = sTalentStore.lookupEntry(talentId);
6285 if (talentInfo == nullptr)
6286 continue;
6287 auto isSingleRankTalent = rank == 0;
6288 if (isSingleRankTalent)
6289 {
6290 for (uint8_t talentRank = 1; talentRank < 5; ++talentRank)
6291 {
6292 if (talentInfo->RankID[talentRank] != 0)
6293 {
6294 isSingleRankTalent = false;
6295 break;
6296 }
6297 }
6298 }
6299 _addSpell(talentInfo->RankID[rank], 0, !isSingleRankTalent);
6300 }
6301
6302 // Set action buttons from new spec
6303 sendActionBars(1);
6304
6305 // Reset power
6306 setPower(getPowerType(), 0);
6307 sendPowerUpdate(false);
6308
6309 // Check offhand
6311
6312 // Send talent points
6314#endif
6315#endif
6316}
#define GLYPHS_COUNT
#define MAX_SPEC_COUNT
SERVER_DECL WDB::WDBContainer< WDB::Structures::TalentEntry > sTalentStore
SERVER_DECL WDB::WDBContainer< WDB::Structures::GlyphPropertiesEntry > sGlyphPropertiesStore
void unSummon() override
Definition Pet.cpp:422
void unEquipOffHandIfRequired()
Definition Player.cpp:6576
uint32_t getGlyph(uint16_t slot) const
Definition Player.cpp:1309
uint8_t m_talentActiveSpec
Definition Player.hpp:1988
void setInitialTalentPoints(bool talentsResetted=false)
Definition Player.cpp:6056
void setTemporarilyUnsummonedPetsOffline()
Definition Player.cpp:12633
void sendActionBars(uint8_t action)
Definition Player.cpp:6384
PowerType getPowerType() const
Definition Unit.cpp:462
void sendPowerUpdate(bool self)
Definition Unit.cpp:6734
void setPower(PowerType type, uint32_t value, bool sendPacket=true, bool skipObjectUpdate=false)
Definition Unit.cpp:547
Here is the call graph for this function:
Here is the caller graph for this function:

◆ activateTaxiPathTo() [1/3]

bool Player::activateTaxiPathTo ( std::vector< uint32_t > const nodes,
Creature npc = nullptr,
uint32_t  spellid = 0 
)

Definition at line 10513 of file Player.cpp.

10514{
10515 if (nodes.size() < 2)
10516 return false;
10517
10518 // not let cheating with start flight in time of logout process || while in combat || has type state: stunned || has type state: root
10520 {
10522 return false;
10523 }
10524
10526 return false;
10527
10528 // taximaster case
10529 if (npc)
10530 {
10531 // not let cheating with start flight mounted
10532 if (isMounted())
10533 {
10535 return false;
10536 }
10537
10539 {
10541 return false;
10542 }
10543 }
10544 // cast case or scripted call case
10545 else
10546 {
10548
10551
10553 if (spell->getSpellInfo()->getId() != spellid)
10555
10557
10559 if (spell->getSpellInfo()->getId() != spellid)
10561 }
10562
10563 uint32_t sourcenode = nodes[0];
10564
10565 // starting node too far away (cheat?)
10566 WDB::Structures::TaxiNodesEntry const* node = sTaxiNodesStore.lookupEntry(sourcenode);
10567 if (!node)
10568 {
10570 return false;
10571 }
10572
10573 // Prepare to flight start now
10574#if VERSION_STRING > TBC
10575 exitVehicle();
10576#endif
10577
10578 // stop trade (client cancel trade at taxi map open but cheating tools can be used for reopen it)
10579 cancelTrade(true);
10580
10581 // clean not finished taxi path if any
10582 m_taxi->clearTaxiDestinations();
10583
10584 // 0 element current node
10585 m_taxi->addTaxiDestination(sourcenode);
10586
10587 // fill destinations path tail
10588 uint32_t sourcepath = 0;
10589 uint32_t totalcost = 0;
10590 uint32_t firstcost = 0;
10591
10592 uint32_t prevnode = sourcenode;
10593 uint32_t lastnode;
10594
10595 for (uint32_t i = 1; i < nodes.size(); ++i)
10596 {
10597 uint32_t path, cost;
10598
10599 lastnode = nodes[i];
10600 sTaxiMgr.getTaxiPath(prevnode, lastnode, path, cost);
10601
10602 if (!path)
10603 {
10604 m_taxi->clearTaxiDestinations();
10605 return false;
10606 }
10607
10608 totalcost += cost;
10609 if (i == 1)
10610 firstcost = cost;
10611
10612 if (prevnode == sourcenode)
10613 sourcepath = path;
10614
10615 m_taxi->addTaxiDestination(lastnode);
10616
10617 prevnode = lastnode;
10618 }
10619
10620 // get mount model (in case non taximaster (npc == nullptr) allow more wide lookup)
10621 uint32_t mount_display_id = sTaxiMgr.getTaxiMountDisplayId(sourcenode, GetTeam(), npc == nullptr || (sourcenode == 315 && getClass() == DEATHKNIGHT));
10622
10623 // in spell case allow 0 model
10624 if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
10625 {
10627 m_taxi->clearTaxiDestinations();
10628 return false;
10629 }
10630
10631 uint64_t money = getCoinage();
10632
10633 if (npc)
10634 {
10635 // Disocunting todo
10636 float discount = 1.0f;
10637 totalcost = uint32_t(ceil(totalcost * discount));
10638 firstcost = uint32_t(round(firstcost * discount));
10639 }
10640
10641 if (money < totalcost)
10642 {
10644 m_taxi->clearTaxiDestinations();
10645 return false;
10646 }
10647
10648 //Checks and preparations done, DO FLIGHT
10649#if VERSION_STRING > TBC
10650 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, 1);
10651#endif
10652
10653 // prevent stealth flight
10654 modCoinage(-(int64_t)firstcost);
10655#if VERSION_STRING > TBC
10656 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, firstcost);
10657#endif
10659 getSession()->sendDoFlight(mount_display_id, sourcepath);
10660 return true;
10661}
@ SPELL_AURA_MOD_SHAPESHIFT
@ SPELL_AURA_MOUNTED
@ CURRENT_CHANNELED_SPELL
Definition Object.hpp:68
@ CURRENT_GENERIC_SPELL
Definition Object.hpp:67
@ CURRENT_AUTOREPEAT_SPELL
Definition Object.hpp:69
@ DEATHKNIGHT
#define sTaxiMgr
Definition TaxiMgr.hpp:156
@ UNIT_FLAG_LOCK_PLAYER
@ UNIT_STATE_ROOTED
@ UNIT_STATE_STUNNED
SERVER_DECL WDB::WDBContainer< WDB::Structures::TaxiNodesEntry > sTaxiNodesStore
void interruptSpell(uint32_t spellId=0, bool checkMeleeSpell=true)
Definition Object.cpp:701
uint32_t GetTeam() const
Definition Object.cpp:4417
Spell * getCurrentSpell(CurrentSpellType spellType) const
Definition Object.cpp:600
uint64_t getCoinage() const
Definition Player.cpp:1184
void modCoinage(int64_t coinage)
Definition Player.cpp:1187
bool isInDisallowedMountForm() const
Definition Player.cpp:4125
bool isInCombat() const
Definition Unit.hpp:289
bool hasUnitStateFlag(uint32_t state_flag) const
Definition Unit.hpp:717
bool hasUnitFlags(uint32_t unitFlags) const
Definition Unit.cpp:1111
uint8_t getClass() const
Definition Unit.cpp:456
bool isMounted() const
Definition Unit.cpp:8541
void sendDoFlight(uint32_t mountDisplayId, uint32_t path, uint32_t pathNode=0)
double round(double f)
Definition g3dmath.h:214
@ ERR_TaxiPlayerShapeshifted
Definition TaxiMgr.hpp:64
@ ERR_UnspecificError
Definition TaxiMgr.hpp:56
@ ERR_TaxiPlayerAlreadyMounted
Definition TaxiMgr.hpp:63
signed __int64 int64_t
unsigned __int64 uint64_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ activateTaxiPathTo() [2/3]

bool Player::activateTaxiPathTo ( uint32_t  taxi_path_id,
Creature npc 
)

Definition at line 10678 of file Player.cpp.

10679{
10680 WDB::Structures::TaxiPathEntry const* entry = sTaxiPathStore.lookupEntry(taxi_path_id);
10681 if (!entry)
10682 return false;
10683
10684 std::vector<uint32_t> nodes;
10685
10686 nodes.resize(2);
10687 nodes[0] = entry->from;
10688 nodes[1] = entry->to;
10689
10690 return activateTaxiPathTo(nodes, npc);
10691}
SERVER_DECL WDB::WDBContainer< WDB::Structures::TaxiPathEntry > sTaxiPathStore
bool activateTaxiPathTo(std::vector< uint32_t > const &nodes, Creature *npc=nullptr, uint32_t spellid=0)
Definition Player.cpp:10513
Here is the call graph for this function:

◆ activateTaxiPathTo() [3/3]

bool Player::activateTaxiPathTo ( uint32_t  taxi_path_id,
uint32_t  spellid = 0 
)

Definition at line 10663 of file Player.cpp.

10664{
10665 WDB::Structures::TaxiPathEntry const* entry = sTaxiPathStore.lookupEntry(taxi_path_id);
10666 if (!entry)
10667 return false;
10668
10669 std::vector<uint32_t> nodes;
10670
10671 nodes.resize(2);
10672 nodes[0] = entry->from;
10673 nodes[1] = entry->to;
10674
10675 return activateTaxiPathTo(nodes, nullptr, spellid);
10676}
Here is the call graph for this function:

◆ addArenaPoints()

void Player::addArenaPoints ( uint32_t  arenaPoints,
bool  sendUpdate 
)

Definition at line 8092 of file Player.cpp.

8093{
8094 this->m_arenaPoints += arenaPoints;
8095 if (this->m_arenaPoints > worldConfig.limit.maxArenaPoints)
8096 this->m_arenaPoints = worldConfig.limit.maxArenaPoints;
8097
8098 if (sendUpdate)
8099 this->updateArenaPoints();
8100}
void updateArenaPoints()
Definition Player.cpp:8117
uint32_t m_arenaPoints
Definition Player.hpp:1358
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addArmorProficiency()

void Player::addArmorProficiency ( uint32_t  proficiency)

Definition at line 5228 of file Player.cpp.

5229{
5230 armorProficiency |= proficiency;
5231}
uint32_t armorProficiency
Definition Player.hpp:981
Here is the caller graph for this function:

◆ addAuraVision()

void Player::addAuraVision ( uint8_t  auraVision)

◆ addCalculatedRestXp()

void Player::addCalculatedRestXp ( uint32_t  seconds)

Definition at line 12224 of file Player.cpp.

12225{
12226 const uint32_t nextLevelXp = getNextLevelXp();
12227
12228 const float restXpRate = worldConfig.getFloatRate(RATE_RESTXP);
12229
12230 auto restXp = static_cast<uint32_t>(0.05f * nextLevelXp * (seconds / (3600 * (8 / restXpRate))));
12231
12232 if (m_isResting)
12233 restXp <<= 2;
12234
12235 m_restAmount += restXp;
12236
12237 if (m_restAmount > nextLevelXp + static_cast<uint32_t>(static_cast<float>(nextLevelXp >> 1) * restXpRate))
12238 m_restAmount = nextLevelXp + static_cast<uint32_t>(static_cast<float>(nextLevelXp >> 1) * restXpRate);
12239
12240 sLogger.debug("Add {} rest XP to a total of {}, RestState {}", restXp, m_restAmount, m_isResting);
12241
12243}
@ RATE_RESTXP
Definition WorldConfig.h:31
uint32_t getNextLevelXp() const
Definition Player.cpp:997
uint32_t m_restAmount
Definition Player.hpp:1751
void updateRestState()
Definition Player.cpp:12262
uint8_t m_isResting
Definition Player.hpp:1749
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addComboPoints()

void Player::addComboPoints ( uint64_t  targetGuid,
int8_t  points 
)

Definition at line 5366 of file Player.cpp.

5367{
5368 // Remove combo point retain auras
5369 // This will not clear points created by retain aura, remove code checks for duration
5370 if (points > 0)
5372
5373 if (getComboPointTarget() == targetGuid)
5374 {
5375 m_comboPoints += points;
5376 }
5377 else
5378 {
5379 // Clear points when switching combo target
5380 m_comboTarget = targetGuid;
5381 m_comboPoints = points;
5382 }
5383
5385}
@ SPELL_AURA_RETAIN_COMBO_POINTS
uint64_t getComboPointTarget() const
Definition Player.cpp:5356
int8_t m_comboPoints
Definition Player.hpp:985
uint64_t m_comboTarget
Definition Player.hpp:984
void updateComboPoints()
Definition Player.cpp:5387
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addDeletedSpell()

void Player::addDeletedSpell ( uint32_t  spellId)

Definition at line 3940 of file Player.cpp.

3941{
3942 m_deletedSpellSet.emplace(spellId);
3943}

◆ addGarbageItem()

void Player::addGarbageItem ( std::unique_ptr< Item item)

Definition at line 6968 of file Player.cpp.

6968{ m_GarbageItems.push_back(std::move(item)); }
std::list< std::unique_ptr< Item > > m_GarbageItems
Definition Player.hpp:1151
Here is the caller graph for this function:

◆ addGlobalCooldown()

void Player::addGlobalCooldown ( SpellInfo const spellInfo,
Spell castingSpell,
const bool  sendPacket = false 
)

Definition at line 4378 of file Player.cpp.

4379{
4380 if (spellInfo->getStartRecoveryTime() == 0 && spellInfo->getStartRecoveryCategory() == 0)
4381 return;
4382
4383 const auto curTime = Util::getMSTime();
4384 auto gcdDuration = static_cast<int32_t>(spellInfo->getStartRecoveryTime());
4385
4386 // Apply global cooldown modifiers
4387 applySpellModifiers(SPELLMOD_GLOBAL_COOLDOWN, &gcdDuration, spellInfo, castingSpell);
4388
4389 // Apply haste modifier only to magic spells
4390 if (spellInfo->getStartRecoveryCategory() == 133 && spellInfo->getDmgClass() == SPELL_DMG_TYPE_MAGIC &&
4391 !(spellInfo->getAttributes() & ATTRIBUTES_RANGED) && !(spellInfo->getAttributes() & ATTRIBUTES_ABILITY))
4392 {
4393 gcdDuration = static_cast<int32_t>(gcdDuration * getModCastSpeed());
4394
4395 // Global cooldown cannot be shorter than 1 second or longer than 1.5 seconds
4396 gcdDuration = std::max(gcdDuration, 1000);
4397 gcdDuration = std::min(gcdDuration, 1500);
4398 }
4399
4400 if (gcdDuration <= 0)
4401 return;
4402
4403 m_globalCooldown = curTime + gcdDuration;
4404
4405 if (sendPacket)
4406 sendSpellCooldownPacket(spellInfo, 0, true);
4407}
@ SPELL_DMG_TYPE_MAGIC
@ ATTRIBUTES_RANGED
@ ATTRIBUTES_ABILITY
@ SPELLMOD_GLOBAL_COOLDOWN
void sendSpellCooldownPacket(SpellInfo const *spellInfo, const uint32_t duration, const bool isGcd)
Definition Player.cpp:4409
uint32_t m_globalCooldown
Definition Player.hpp:918
void applySpellModifiers(SpellModifierType modType, T *value, SpellInfo const *spellInfo, Spell *castingSpell=nullptr, Aura *castingAura=nullptr)
Definition Unit.cpp:4465
float getModCastSpeed() const
Definition Unit.cpp:1421
signed int int32_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addGroupUpdateFlag()

void Player::addGroupUpdateFlag ( uint32_t  flag)

Definition at line 7908 of file Player.cpp.

7909{
7910 if (getGroup())
7911 m_groupUpdateFlags |= flag;
7912}
Group * getGroup()
Definition Player.cpp:7887
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addHonor()

void Player::addHonor ( uint32_t  honorPoints,
bool  sendUpdate 
)

Definition at line 8133 of file Player.cpp.

8134{
8135 if (this->GetMapId() == 559 || this->GetMapId() == 562 || this->GetMapId() == 572)
8136 return;
8137
8138 this->m_honorPoints += honorPoints;
8139 this->m_honorToday += honorPoints;
8140 if (this->m_honorPoints > worldConfig.limit.maxHonorPoints)
8141 this->m_honorPoints = worldConfig.limit.maxHonorPoints;
8142
8143 if (sendUpdate)
8144 this->updateHonor();
8145}
uint32_t GetMapId() const
Definition Object.hpp:468
uint32_t m_honorToday
Definition Player.hpp:1388
void updateHonor()
Definition Player.cpp:8162
uint32_t m_honorPoints
Definition Player.hpp:1383
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addInstanceEnterTime()

void Player::addInstanceEnterTime ( uint32_t  instanceId,
time_t  enterTime 
)

Definition at line 13128 of file Player.cpp.

13129{
13130 if (m_instanceResetTimes.find(instanceId) == m_instanceResetTimes.end())
13131 m_instanceResetTimes.insert(InstanceTimeMap::value_type(instanceId, enterTime + HOUR));
13132}
InstanceTimeMap m_instanceResetTimes
Definition Player.hpp:2153
@ HOUR
Definition Definitions.h:13
Here is the caller graph for this function:

◆ addItemsToWorld()

void Player::addItemsToWorld ( )

Definition at line 16083 of file Player.cpp.

16084{
16085 for (uint8_t slotIndex = 0; slotIndex < CURRENCYTOKEN_SLOT_END; ++slotIndex)
16086 {
16087 if (Item* inventoryItem = getItemInterface()->GetInventoryItem(slotIndex))
16088 {
16089 inventoryItem->PushToWorld(m_WorldMap);
16090
16091 if (slotIndex < INVENTORY_SLOT_BAG_END)
16092 applyItemMods(inventoryItem, slotIndex, true, false, true);
16093
16094 if (slotIndex >= CURRENCYTOKEN_SLOT_START)
16095 updateKnownCurrencies(inventoryItem->getEntry(), true);
16096
16097 if (inventoryItem->isContainer() && getItemInterface()->IsBagSlot(slotIndex))
16098 {
16099 for (uint32_t containerSlot = 0; containerSlot < inventoryItem->getItemProperties()->ContainerSlots; ++containerSlot)
16100 {
16101 if (Item* item = (static_cast<Container*>(inventoryItem))->getItem(static_cast<int16_t>(containerSlot)))
16102 item->PushToWorld(m_WorldMap);
16103 }
16104 }
16105 }
16106 }
16107
16108 updateStats();
16109}
@ INVENTORY_SLOT_BAG_END
#define CURRENCYTOKEN_SLOT_START
#define CURRENCYTOKEN_SLOT_END
void updateStats()
Definition Player.cpp:15532
void applyItemMods(Item *item, int16_t slot, bool apply, bool justBrokedown=false, bool skipStatApply=false)
Definition Player.cpp:6972
void updateKnownCurrencies(uint32_t itemId, bool apply)
Definition Player.cpp:13232
signed short int16_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addNewFaction()

bool Player::addNewFaction ( WDB::Structures::FactionEntry const factionEntry,
int32_t  standing,
bool  base 
)

Definition at line 11709 of file Player.cpp.

11710{
11711 if (!factionEntry || factionEntry->RepListId < 0)
11712 return false;
11713
11714 for (uint8_t i = 0; i < 4; ++i)
11715 {
11716 if ((factionEntry->RaceMask[i] & getRaceMask() ||
11717 factionEntry->RaceMask[i] == 0 && factionEntry->ClassMask[i] != 0) &&
11718 (factionEntry->ClassMask[i] & getClassMask() || factionEntry->ClassMask[i] == 0))
11719 {
11720 const auto flag = static_cast<uint8_t>(factionEntry->repFlags[i]);
11721 const auto baseStanding = factionEntry->baseRepValue[i];
11722 const auto m_standing = (base) ? factionEntry->baseRepValue[i] : standing;
11723
11724 const auto [repItr, _] = m_reputation.insert_or_assign(factionEntry->ID, std::make_unique<FactionReputation>(m_standing, flag, baseStanding));
11725 m_reputationByListId[factionEntry->RepListId] = repItr->second.get();
11726
11727 return true;
11728 }
11729 }
11730 return false;
11731}
FactionReputation * m_reputationByListId[128]
Definition Player.hpp:1692
ReputationMap m_reputation
Definition Player.hpp:1690
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addNoteToFriend()

void Player::addNoteToFriend ( uint32_t  guid,
std::string  note 
)

Definition at line 9197 of file Player.cpp.

9198{
9199 std::lock_guard<std::mutex> guard(m_mutexFriendList);
9200 for (const auto friends : m_socialIFriends)
9201 {
9202 if (friends.friendGuid == guid)
9203 {
9204 friends.note = note;
9205 CharacterDatabase.Execute("UPDATE social_friends SET note = \'%s\' WHERE character_guid = %u AND friend_guid = %u",
9206 !note.empty() ? CharacterDatabase.EscapeString(note).c_str() : "", getGuidLow(), guid);
9207 }
9208 }
9209}
std::mutex m_mutexFriendList
Definition Player.hpp:1560
std::vector< SocialFriends > m_socialIFriends
Definition Player.hpp:1559
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addPetCache()

void Player::addPetCache ( std::unique_ptr< PetCache petCache,
uint8_t  index 
)

Definition at line 12304 of file Player.cpp.

12305{
12306 m_cachedPetSlots.emplace(pet->slot, index);
12307 m_cachedPets.emplace(index, std::move(pet));
12308}
Here is the caller graph for this function:

◆ addPlayerFieldBytesMiscFlag()

void Player::addPlayerFieldBytesMiscFlag ( uint8_t  miscFlag)

Definition at line 1231 of file Player.cpp.

uint8_t getPlayerFieldBytesMiscFlag() const
Definition Player.cpp:1229
void setPlayerFieldBytesMiscFlag(uint8_t miscFlag)
Definition Player.cpp:1230
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addPlayerFlags()

void Player::addPlayerFlags ( uint32_t  flags)

Definition at line 784 of file Player.cpp.

784{ setPlayerFlags(getPlayerFlags() | flags); }
void setPlayerFlags(uint32_t flags)
Definition Player.cpp:769
uint32_t getPlayerFlags() const
Definition Player.cpp:768
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addQuestIdToFinishedDailies()

void Player::addQuestIdToFinishedDailies ( uint32_t  questId)

Definition at line 8877 of file Player.cpp.

8878{
8879 std::lock_guard<std::mutex> lock(m_mutextDailies);
8880 m_finishedDailies.insert(questId);
8881}
std::set< uint32_t > m_finishedDailies
Definition Player.hpp:1524
std::mutex m_mutextDailies
Definition Player.hpp:1523
Here is the caller graph for this function:

◆ addQuestKill()

void Player::addQuestKill ( uint32_t  questId,
uint8_t  reqId,
uint32_t  delay = 0 
)

Definition at line 9015 of file Player.cpp.

9016{
9017 if (!hasQuestInQuestLog(questId))
9018 return;
9019
9020 if (delay)
9021 {
9022 sEventMgr.AddEvent(this, &Player::addQuestKill, questId, reqId, static_cast<uint32_t>(0), EVENT_PLAYER_UPDATE, delay, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
9023 return;
9024 }
9025
9026 if (QuestLogEntry* questLogEntry = getQuestLogByQuestId(questId))
9027 {
9028 if (QuestProperties const* quest = questLogEntry->getQuestProperties())
9029 {
9030 if (questLogEntry->getMobCountByIndex(reqId) >= quest->required_mob_or_go_count[reqId])
9031 return;
9032
9033 questLogEntry->incrementMobCountForIndex(reqId);
9034 questLogEntry->sendUpdateAddKill(reqId);
9035 questLogEntry->updatePlayerFields();
9036
9037 if (questLogEntry->canBeFinished())
9038 questLogEntry->sendQuestComplete();
9039 }
9040 }
9041}
@ EVENT_PLAYER_UPDATE
Definition EventMgr.h:33
@ EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT
Definition EventMgr.h:109
void addQuestKill(uint32_t questId, uint8_t reqId, uint32_t delay=0)
Definition Player.cpp:9015
QuestLogEntry * getQuestLogByQuestId(uint32_t questId) const
Definition Player.cpp:8859
Here is the call graph for this function:

◆ addQuestMob()

void Player::addQuestMob ( uint32_t  entry)

Definition at line 8997 of file Player.cpp.

8997{ quest_mobs.insert(entry); }
std::set< uint32_t > quest_mobs
Definition Player.hpp:1530
Here is the caller graph for this function:

◆ addQuestSpell()

void Player::addQuestSpell ( uint32_t  spellId)

Definition at line 8979 of file Player.cpp.

8979{ quest_spells.insert(spellId); }
std::set< uint32_t > quest_spells
Definition Player.hpp:1529
Here is the caller graph for this function:

◆ addQuestToFinished()

void Player::addQuestToFinished ( uint32_t  questId)

Definition at line 8927 of file Player.cpp.

8928{
8929 if (m_finishedQuests.find(questId) != m_finishedQuests.end())
8930 return;
8931
8932 m_finishedQuests.insert(questId);
8933}
std::set< uint32_t > m_finishedQuests
Definition Player.hpp:1527
Here is the caller graph for this function:

◆ addQuestToRemove()

void Player::addQuestToRemove ( uint32_t  questId)

Definition at line 8925 of file Player.cpp.

8925{ m_removequests.insert(questId); }
Here is the caller graph for this function:

◆ addShapeShiftSpell()

void Player::addShapeShiftSpell ( uint32_t  spellId)

Definition at line 4061 of file Player.cpp.

4062{
4063 SpellInfo const* spellInfo = sSpellMgr.getSpellInfo(spellId);
4064 m_shapeshiftSpells.emplace(spellId);
4065
4066 if (spellInfo->getRequiredShapeShift() && getShapeShiftMask() & spellInfo->getRequiredShapeShift())
4067 {
4068 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr);
4069 SpellCastTargets spellCastTargets(this->getGuid());
4070 spell->prepare(&spellCastTargets);
4071 }
4072}
SpellSet m_shapeshiftSpells
Definition Player.hpp:970
uint32_t getRequiredShapeShift() const
SpellCastResult prepare(SpellCastTargets *targets)
Definition Spell.cpp:255
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSkillLine()

void Player::addSkillLine ( uint16_t  skillLine,
uint16_t  currentValue,
uint16_t  maxValue,
bool  noSpellLearning = false,
bool  initializeProfession = false 
)

Definition at line 4760 of file Player.cpp.

4761{
4762 if (skillLine == 0)
4763 return;
4764
4765 const auto skillEntry = sSkillLineStore.lookupEntry(skillLine);
4766 if (skillEntry == nullptr)
4767 return;
4768
4769 uint16_t skillStep = 0;
4770 currentValue = currentValue > DBC_PLAYER_SKILL_MAX ? DBC_PLAYER_SKILL_MAX : currentValue;
4771 maxValue = maxValue > DBC_PLAYER_SKILL_MAX ? DBC_PLAYER_SKILL_MAX : maxValue;
4772
4773 if (!initializeProfession)
4774 currentValue = currentValue < 1 ? 1U : currentValue;
4775
4776 const auto onLearnedNewSkill = [&](uint16_t curVal, uint16_t skillStep, bool isPrimaryProfession) -> void
4777 {
4778#if VERSION_STRING >= Cata
4779 // Profession skill line
4780 if (isPrimaryProfession)
4781 {
4782 if (getProfessionSkillLine(0) == 0 && getProfessionSkillLine(1) != skillLine)
4783 setProfessionSkillLine(0, skillLine);
4784 else if (getProfessionSkillLine(1) == 0 && getProfessionSkillLine(0) != skillLine)
4785 setProfessionSkillLine(1, skillLine);
4786 }
4787#endif
4788 // Set profession points
4789 if (isPrimaryProfession)
4791
4792 // Reapply skill passive auras
4793 for (const auto& aura : getAuraList())
4794 {
4795 if (aura == nullptr)
4796 continue;
4797
4798 for (uint8_t i = 0; i < MAX_SPELL_EFFECTS; ++i)
4799 {
4800 const auto aurEff = aura->getAuraEffect(i);
4801 if (aurEff->getAuraEffectType() == SPELL_AURA_NONE)
4802 continue;
4803
4804 if (aurEff->getAuraEffectType() != SPELL_AURA_MOD_SKILL &&
4805 aurEff->getAuraEffectType() != SPELL_AURA_MOD_SKILL_TALENT
4806#if VERSION_STRING >= TBC
4807 && aurEff->getAuraEffectType() != SPELL_AURA_MOD_ALL_WEAPON_SKILLS
4808#endif
4809 )
4810 continue;
4811
4812 const auto effType = aurEff->getAuraEffectType();
4813 if (aurEff->getEffectMiscValue() == skillLine)
4814 aura->applyModifiers(true, effType);
4815 }
4816 }
4817
4818 if (!noSpellLearning)
4819 learnSkillSpells(skillLine, curVal);
4820
4821#ifdef FT_ACHIEVEMENTS
4822 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, skillLine, skillStep, 0);
4823 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, skillLine, currentValue, 0);
4824#endif
4825 };
4826
4827 auto itr = m_skills.find(skillLine);
4828 if (itr != m_skills.end())
4829 {
4830 _verifySkillValues(skillEntry, &currentValue, &maxValue, &skillStep);
4831
4832 if (!((currentValue > itr->second.CurrentValue && maxValue >= itr->second.MaximumValue) || (currentValue == itr->second.CurrentValue && maxValue > itr->second.MaximumValue)))
4833 return;
4834
4835 itr->second.CurrentValue = currentValue;
4836 itr->second.MaximumValue = maxValue;
4837
4838 // Update skill fields
4839 _updateSkillFieldOnValueChange(itr->second.FieldPosition, skillStep, itr->second.CurrentValue, itr->second.MaximumValue);
4840
4841 if (itr->second.CurrentValue > 0)
4842 onLearnedNewSkill(itr->second.CurrentValue, skillStep, itr->second.Skill->type == SKILL_TYPE_PROFESSION);
4843 }
4844 else
4845 {
4846 // Find a skill field position for skill
4847 auto foundPosition = false;
4848 PlayerSkillFieldPosition fieldPosition;
4849 for (uint16_t i = 0; i < WOWPLAYER_SKILL_INFO_COUNT; ++i)
4850 {
4851#if VERSION_STRING >= Cata
4852 const uint16_t field = i / 2;
4853 const uint8_t offset = i & 1;
4854 if (getSkillInfoId(field, offset) == 0)
4855 {
4856 fieldPosition.field = field;
4857 fieldPosition.offset = offset;
4858 foundPosition = true;
4859 break;
4860 }
4861#else
4862 if (getSkillInfoId(i) == 0)
4863 {
4864 fieldPosition.index = i;
4865 foundPosition = true;
4866 break;
4867 }
4868#endif
4869 }
4870
4871 if (!foundPosition)
4872 {
4873 sLogger.failure("Player::addSkillLine : Could not add skill line {} to player (guid {}), skill fields are full!", skillLine, getGuidLow());
4874 return;
4875 }
4876
4877 PlayerSkill newSkill;
4878 newSkill.Skill = skillEntry;
4879 newSkill.CurrentValue = currentValue;
4880 newSkill.MaximumValue = maxValue;
4881 newSkill.FieldPosition = fieldPosition;
4882
4883 if (!initializeProfession)
4884 _verifySkillValues(skillEntry, &newSkill.CurrentValue, &newSkill.MaximumValue, &skillStep);
4885
4886 m_skills.insert(std::make_pair(skillLine, newSkill));
4887
4888 // Update skill fields
4889#if VERSION_STRING < Cata
4890 // field 0
4891 setSkillInfoId(fieldPosition.index, skillLine);
4892 setSkillInfoStep(fieldPosition.index, skillStep);
4893 // field 1
4894 setSkillInfoCurrentValue(fieldPosition.index, newSkill.CurrentValue);
4895 setSkillInfoMaxValue(fieldPosition.index, newSkill.MaximumValue);
4896#else
4897 // field 0
4898 setSkillInfoId(fieldPosition.field, fieldPosition.offset, skillLine);
4899 setSkillInfoStep(fieldPosition.field, fieldPosition.offset, skillStep);
4900 // field 1
4901 setSkillInfoCurrentValue(fieldPosition.field, fieldPosition.offset, newSkill.CurrentValue);
4902 setSkillInfoMaxValue(fieldPosition.field, fieldPosition.offset, newSkill.MaximumValue);
4903#endif
4904 // field 2
4905 _updateSkillBonusFields(fieldPosition, 0, 0);
4906
4907 if (newSkill.CurrentValue > 0)
4908 onLearnedNewSkill(newSkill.CurrentValue, skillStep, newSkill.Skill->type == SKILL_TYPE_PROFESSION);
4909 }
4910}
@ SPELL_AURA_MOD_ALL_WEAPON_SKILLS
@ SPELL_AURA_MOD_SKILL
@ SPELL_AURA_NONE
@ SPELL_AURA_MOD_SKILL_TALENT
SERVER_DECL WDB::WDBContainer< WDB::Structures::SkillLineEntry > sSkillLineStore
Definition WDBStores.cpp:97
static constexpr uint8_t WOWPLAYER_SKILL_INFO_COUNT
Definition WoWPlayer.hpp:74
SkillMap m_skills
Definition Player.hpp:979
uint16_t getSkillInfoId(uint32_t index, uint8_t offset) const
Definition Player.cpp:1014
void _updateSkillFieldOnValueChange(const PlayerSkillFieldPosition fieldPosition, uint16_t skillStep, uint16_t currentValue, uint16_t maxValue)
Definition Player.cpp:5783
void setProfessionSkillLine(uint32_t index, uint32_t value)
Definition Player.cpp:1027
void learnSkillSpells(uint16_t skillLine, uint16_t currentValue)
Definition Player.cpp:4976
uint32_t getProfessionSkillLine(uint32_t index) const
Definition Player.cpp:1020
void _updateSkillBonusFields(const PlayerSkillFieldPosition fieldPosition, uint16_t tempBonus, uint16_t permBonus)
Definition Player.cpp:5800
void setSkillInfoId(uint32_t index, uint8_t offset, uint16_t id)
Definition Player.cpp:1021
void modFreePrimaryProfessionPoints(int32_t amount)
Definition Player.cpp:1064
AuraArray const & getAuraList() const
Definition Unit.cpp:5747
static void field(LexState *ls, ConsControl *cc)
Definition lparser.c:902
WDB::Structures::SkillLineEntry const * Skill
PlayerSkillFieldPosition FieldPosition
uint16_t CurrentValue
uint16_t MaximumValue
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSpell()

void Player::addSpell ( uint32_t  spellId,
uint16_t  fromSkill = 0 
)

Definition at line 3935 of file Player.cpp.

3936{
3937 _addSpell(spellId, fromSkill, false, false);
3938}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSpellCooldown()

void Player::addSpellCooldown ( SpellInfo const spellInfo,
Item const itemCaster,
Spell castingSpell = nullptr,
int32_t  cooldownTime = 0 
)

Definition at line 4347 of file Player.cpp.

4348{
4349 const auto curTime = Util::getMSTime();
4350 const auto spellId = spellInfo->getId();
4351
4352 // Set category cooldown
4353 int32_t spellCategoryCooldown = static_cast<int32_t>(spellInfo->getCategoryRecoveryTime());
4354 if (spellCategoryCooldown > 0 && spellInfo->getCategory() > 0)
4355 {
4356 // Add cooldown modifiers
4357 if (castingSpell != nullptr)
4358 applySpellModifiers(SPELLMOD_COOLDOWN_DECREASE, &spellCategoryCooldown, spellInfo, castingSpell);
4359
4360 _addCategoryCooldown(spellInfo->getCategory(), spellCategoryCooldown + curTime, spellId, itemCaster != nullptr ? itemCaster->getEntry() : 0);
4361 }
4362
4363 // Set spell cooldown
4364 int32_t spellCooldown = cooldownTime == 0 ? static_cast<int32_t>(spellInfo->getRecoveryTime()) : cooldownTime;
4365 if (spellCooldown > 0)
4366 {
4367 // Add cooldown modifers
4368 if (castingSpell != nullptr)
4369 applySpellModifiers(SPELLMOD_COOLDOWN_DECREASE, &spellCooldown, spellInfo, castingSpell);
4370
4371 _addCooldown(COOLDOWN_TYPE_SPELL, spellId, spellCooldown + curTime, spellId, itemCaster != nullptr ? itemCaster->getEntry() : 0);
4372 }
4373
4374 // Send cooldown packet
4375 sendSpellCooldownPacket(spellInfo, spellCooldown > spellCategoryCooldown ? spellCooldown : spellCategoryCooldown, false);
4376}
@ COOLDOWN_TYPE_SPELL
@ SPELLMOD_COOLDOWN_DECREASE
void _addCooldown(uint32_t type, uint32_t mis, uint32_t time, uint32_t SpellId, uint32_t ItemId)
Definition Player.cpp:4601
void _addCategoryCooldown(uint32_t categoryId, uint32_t time, uint32_t SpellId, uint32_t ItemId)
Definition Player.cpp:4575
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSummonSpell()

void Player::addSummonSpell ( uint32_t  entry,
uint32_t  spellId 
)

Definition at line 13969 of file Player.cpp.

13970{
13971 SpellInfo const* sp = sSpellMgr.getSpellInfo(spellId);
13972 std::map<uint32_t, std::set<uint32_t> >::iterator itr = m_summonSpells.find(entry);
13973 if (itr == m_summonSpells.end())
13974 {
13975 m_summonSpells[entry].insert(spellId);
13976 }
13977 else
13978 {
13979 if (sp->hasSpellRanks())
13980 {
13981 std::set<uint32_t>::iterator it3;
13982 for (std::set<uint32_t>::iterator it2 = itr->second.begin(); it2 != itr->second.end();)
13983 {
13984 it3 = it2++;
13985 const auto se = sSpellMgr.getSpellInfo(*it3);
13986 if (se == nullptr || !se->hasSpellRanks())
13987 continue;
13988
13990 itr->second.erase(it3);
13991 }
13992 }
13993 itr->second.insert(spellId);
13994 }
13995}
bool hasSpellRanks() const
SpellRankInfo const * getRankInfo() const
bool isSpellPartOfThisSpellRankChain(uint32_t spellId) const
Definition SpellInfo.cpp:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addTalentPoints()

void Player::addTalentPoints ( uint32_t  talentPoints,
bool  forBothSpecs = true 
)

Definition at line 6037 of file Player.cpp.

6038{
6039 if (!forBothSpecs)
6040 setTalentPoints(getActiveSpec().getTalentPoints() + talentPoints);
6041 else
6042 {
6043#ifndef FT_DUAL_SPEC
6044 setTalentPoints(getActiveSpec().getTalentPoints() + talentPoints);
6045#else
6046 m_specs[SPEC_PRIMARY].setTalentPoints(m_specs[SPEC_PRIMARY].getTalentPoints() + talentPoints);
6047 m_specs[SPEC_SECONDARY].setTalentPoints(m_specs[SPEC_SECONDARY].getTalentPoints() + talentPoints);
6048
6049#if VERSION_STRING < Cata
6050 setFreeTalentPoints(getFreeTalentPoints() + talentPoints);
6051#endif
6052#endif
6053 }
6054}
@ SPEC_SECONDARY
Definition Spec.hpp:11
@ SPEC_PRIMARY
Definition Spec.hpp:10
void setTalentPoints(uint32_t talentPoints, bool forBothSpecs=true)
Definition Player.cpp:6017
uint32_t getFreeTalentPoints() const
Definition Player.cpp:1030
PlayerSpec & getActiveSpec()
Definition Player.cpp:9393
Here is the call graph for this function:

◆ addToFriendList()

void Player::addToFriendList ( std::string  name,
std::string  note 
)

Definition at line 9120 of file Player.cpp.

9121{
9122 if (auto* targetPlayer = sObjectMgr.getPlayer(name.c_str()))
9123 {
9124 // we can not add us ;)
9125 if (targetPlayer->getGuidLow() == getGuidLow())
9126 {
9128 return;
9129 }
9130
9131 if (targetPlayer->isGMFlagSet())
9132 {
9134 return;
9135 }
9136
9137 if (isFriended(targetPlayer->getGuidLow()))
9138 {
9139 m_session->SendPacket(SmsgFriendStatus(FRIEND_ALREADY, targetPlayer->getGuidLow()).serialise().get());
9140 return;
9141 }
9142
9143 if (targetPlayer->getPlayerInfo()->team != getInitialTeam() && !m_session->hasPermissions() && !worldConfig.player.isInterfactionFriendsEnabled)
9144 {
9145 m_session->SendPacket(SmsgFriendStatus(FRIEND_ENEMY, targetPlayer->getGuidLow()).serialise().get());
9146 return;
9147 }
9148
9149 if (targetPlayer->getSession())
9150 {
9151 m_session->SendPacket(SmsgFriendStatus(FRIEND_ADDED_ONLINE, targetPlayer->getGuidLow(), note, 1,
9152 targetPlayer->getZoneId(), targetPlayer->getLevel(), targetPlayer->getClass()).serialise().get());
9153 }
9154 else
9155 {
9156 m_session->SendPacket(SmsgFriendStatus(FRIEND_ADDED_OFFLINE, targetPlayer->getGuidLow()).serialise().get());
9157 }
9158
9159 // todo: missing FRIEND_LIST_FULL when friend list is full
9160
9161 CharacterDatabase.Execute("INSERT INTO social_friends VALUES(%u, %u, \'%s\')",
9162 getGuidLow(), targetPlayer->getGuidLow(), !note.empty() ? CharacterDatabase.EscapeString(std::string(note)).c_str() : "");
9163
9164 SocialFriends socialFriend;
9165 socialFriend.friendGuid = targetPlayer->getGuidLow();
9166 socialFriend.note = note;
9167
9168 std::lock_guard<std::mutex> guard(m_mutexFriendList);
9169 m_socialIFriends.push_back(socialFriend);
9170 }
9171 else
9172 {
9174 }
9175}
@ FRIEND_ENEMY
@ FRIEND_ALREADY
@ FRIEND_ADDED_OFFLINE
@ FRIEND_NOT_FOUND
@ FRIEND_ADDED_ONLINE
@ FRIEND_SELF
bool isFriended(uint32_t guid) const
Definition Player.cpp:9211
uint32_t getInitialTeam() const
Definition Player.cpp:2779
bool hasPermissions() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addToGMTargetList()

void Player::addToGMTargetList ( uint32_t  guid)

Definition at line 2399 of file Player.cpp.

2400{
2401 std::lock_guard<std::mutex> guard(m_lockGMTargetList);
2402 m_gmPlayerTargetList.push_back(guid);
2403}
std::vector< uint32_t > m_gmPlayerTargetList
Definition Player.hpp:1121
std::mutex m_lockGMTargetList
Definition Player.hpp:1122
Here is the caller graph for this function:

◆ addToIgnoreList()

void Player::addToIgnoreList ( std::string  name)

Definition at line 9303 of file Player.cpp.

9304{
9305 if (auto* targetPlayer = sObjectMgr.getPlayer(name.c_str()))
9306 {
9307 // we can not add us ;)
9308 if (targetPlayer->getGuidLow() == getGuidLow())
9309 {
9311 return;
9312 }
9313
9314 if (targetPlayer->isGMFlagSet())
9315 {
9317 return;
9318 }
9319
9320 if (isIgnored(targetPlayer->getGuidLow()))
9321 {
9322 m_session->SendPacket(SmsgFriendStatus(FRIEND_IGNORE_ALREADY, targetPlayer->getGuidLow()).serialise().get());
9323 return;
9324 }
9325
9326 // todo: missing FRIEND_IGNORE_FULL when ignore list is full
9327
9328 CharacterDatabase.Execute("INSERT INTO social_ignores VALUES(%u, %u)", getGuidLow(), targetPlayer->getGuidLow());
9329
9330 std::lock_guard<std::mutex> guard(m_mutexIgnoreList);
9331 m_socialIgnoring.push_back(targetPlayer->getGuidLow());
9332
9333 m_session->SendPacket(SmsgFriendStatus(FRIEND_IGNORE_ADDED, targetPlayer->getGuidLow()).serialise().get());
9334 }
9335 else
9336 {
9338 }
9339}
@ FRIEND_IGNORE_ADDED
@ FRIEND_IGNORE_NOT_FOUND
@ FRIEND_IGNORE_SELF
@ FRIEND_IGNORE_ALREADY
bool isIgnored(uint32_t guid) const
Definition Player.cpp:9358
std::vector< uint32_t > m_socialIgnoring
Definition Player.hpp:1565
std::mutex m_mutexIgnoreList
Definition Player.hpp:1566
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addToInRangeObjects()

void Player::addToInRangeObjects ( Object object)
overridevirtual

Reimplemented from Unit.

Definition at line 15775 of file Player.cpp.

15776{
15778}
virtual void addToInRangeObjects(Object *pObj)
Definition Unit.cpp:7559
Here is the call graph for this function:

◆ AddToWorld() [1/2]

void Player::AddToWorld ( )
virtual

Reimplemented from Object.

Definition at line 473 of file Player.cpp.

474{
475 if (auto transport = this->GetTransport())
476 {
477 this->SetPosition(transport->GetPositionX() + GetTransOffsetX(),
478 transport->GetPositionY() + GetTransOffsetY(),
479 transport->GetPositionZ() + GetTransOffsetZ(),
480 GetOrientation(), false);
481 }
482
483 // If we join an invalid instance and get booted out, this will prevent our stats from doubling :P
484 if (IsInWorld())
485 return;
486
487 m_beingPushed = true;
489
490 if (m_WorldMap == nullptr)
491 {
492 m_beingPushed = false;
494 return;
495 }
496
497 if (m_session)
499
500#if VERSION_STRING > TBC
502#endif
503}
float GetTransOffsetY() const
Definition Object.hpp:382
const float & GetOrientation() const
Definition Object.hpp:357
float GetTransOffsetX() const
Definition Object.hpp:381
Transporter * GetTransport() const
Definition Object.hpp:379
float GetTransOffsetZ() const
Definition Object.hpp:383
virtual void AddToWorld()
Definition Object.cpp:3449
bool m_beingPushed
Definition Player.hpp:2175
void ejectFromInstance()
Definition Player.cpp:2301
void sendInstanceDifficultyPacket(uint8_t difficulty)
Definition Player.cpp:9591
InstanceDifficulty::Difficulties getDifficulty() const
Definition WorldMap.hpp:216
uint32_t getInstanceId() const
Definition WorldMap.hpp:255
void SetInstance(uint32_t Instance)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddToWorld() [2/2]

void Player::AddToWorld ( WorldMap pMapMgr)
virtual

Reimplemented from Object.

Definition at line 505 of file Player.cpp.

506{
507 if (auto transport = this->GetTransport())
508 {
509 auto t_loc = transport->GetPosition();
510 this->SetPosition(t_loc.x + this->GetTransOffsetX(),
511 t_loc.y + this->GetTransOffsetY(),
512 t_loc.z + this->GetTransOffsetZ(),
513 this->GetOrientation(), false);
514 }
515
516 // If we join an invalid instance and get booted out, this will prevent our stats from doubling :P
517 if (IsInWorld())
518 return;
519
520 m_beingPushed = true;
521 Object::AddToWorld(pMapMgr);
522
523 if (m_WorldMap == nullptr)
524 {
525 m_beingPushed = false;
527 return;
528 }
529
530 if (m_session)
532
533#if VERSION_STRING > TBC
535#endif
536}
Here is the call graph for this function:

◆ addVisibleObject()

void Player::addVisibleObject ( uint64_t  guid)

Definition at line 3587 of file Player.cpp.

3587{ m_visibleObjects.insert(guid); }
std::set< uint64_t > m_visibleObjects
Definition Player.hpp:803
Here is the caller graph for this function:

◆ addWeaponProficiency()

void Player::addWeaponProficiency ( uint32_t  proficiency)

Definition at line 5243 of file Player.cpp.

5244{
5245 weaponProficiency |= proficiency;
5246}
uint32_t weaponProficiency
Definition Player.hpp:982
Here is the caller graph for this function:

◆ addXP()

void Player::addXP ( uint32_t  xp)

Definition at line 995 of file Player.cpp.

995{ write(playerData()->xp, getXp() + xp); }
bool write(const uint8_t &member, uint8_t val, bool skipObjectUpdate=false)
Definition Object.cpp:106
uint32_t getXp() const
Definition Player.cpp:993
const WoWPlayer * playerData() const
Definition Player.hpp:126
Here is the call graph for this function:

◆ advanceAllSkills()

void Player::advanceAllSkills ( uint16_t  amount = 1)

Definition at line 4705 of file Player.cpp.

4706{
4707 for (const auto& itr : m_skills)
4708 {
4709 advanceSkillLine(itr.first, amount);
4710 }
4711}
void advanceSkillLine(uint16_t skillLine, uint16_t amount=1)
Definition Player.cpp:4713
Here is the call graph for this function:
Here is the caller graph for this function:

◆ advanceSkillLine()

void Player::advanceSkillLine ( uint16_t  skillLine,
uint16_t  amount = 1 
)

Definition at line 4713 of file Player.cpp.

4714{
4715 if (skillLine == 0)
4716 return;
4717
4718 auto itr = m_skills.find(skillLine);
4719 if (itr == m_skills.end() || itr->second.CurrentValue == 0)
4720 {
4721 // Add the skill line to player
4722 // addSkillLine will set correct maximum value
4723 addSkillLine(skillLine, amount, 0);
4724 sHookInterface.OnAdvanceSkillLine(this, skillLine, amount);
4725 return;
4726 }
4727
4728 uint16_t skillStep = 0;
4729 const auto currentValue = itr->second.CurrentValue;
4730
4731 const uint16_t newValue = currentValue + amount;
4732 itr->second.CurrentValue = std::min(newValue, itr->second.MaximumValue);
4733
4734 // Skill value did not change
4735 if (itr->second.CurrentValue == currentValue)
4736 return;
4737
4738 // Get skill step
4739 if (itr->second.Skill->type == SKILL_TYPE_PROFESSION || itr->second.Skill->type == SKILL_TYPE_SECONDARY)
4740 skillStep = itr->second.MaximumValue / 75U;
4741
4742 // Update skill fields
4743#if VERSION_STRING >= Cata
4744 if (itr->second.Skill->type != SKILL_TYPE_WEAPON)
4745#endif
4746 {
4747 _updateSkillFieldOnValueChange(itr->second.FieldPosition, skillStep, itr->second.CurrentValue, itr->second.MaximumValue);
4748 }
4749
4750 sHookInterface.OnAdvanceSkillLine(this, skillLine, itr->second.CurrentValue);
4751
4752#ifdef FT_ACHIEVEMENTS
4753 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, skillLine, skillStep);
4754 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, skillLine, itr->second.CurrentValue);
4755#endif
4756
4757 learnSkillSpells(skillLine, itr->second.CurrentValue);
4758}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyFeralAttackPower()

void Player::applyFeralAttackPower ( bool  apply,
Item item = NULL 
)

Definition at line 13337 of file Player.cpp.

13338{
13339 float feralAttackPower = 0.0f;
13340
13341 Item* applyItem = item;
13342 if (applyItem == nullptr)
13344
13345 if (applyItem)
13346 {
13347 float delay = static_cast<float>(applyItem->getItemProperties()->Delay) / 1000.0f;
13348 delay = std::max(1.0f, delay);
13349 float dps = ((applyItem->getItemProperties()->Damage[0].Min + applyItem->getItemProperties()->Damage[0].Max) / 2) / delay;
13350 if (dps > 54.8f)
13351 feralAttackPower = (dps - 54.8f) * 14;
13352 }
13353 modifyBonuses(ITEM_MOD_FERAL_ATTACK_POWER, static_cast<int32_t>(feralAttackPower), apply);
13354}
@ EQUIPMENT_SLOT_MAINHAND
@ ITEM_MOD_FERAL_ATTACK_POWER
Item * GetInventoryItem(int16_t slot)
Gets a item from Inventory.
ItemProperties const * getItemProperties() const
Definition Item.cpp:954
void modifyBonuses(uint32_t type, int32_t val, bool apply)
Definition Player.cpp:16317
ItemDamage Damage[MAX_ITEM_PROTO_DAMAGES]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyForcedReaction()

void Player::applyForcedReaction ( uint32_t  faction_id,
Standing  rank,
bool  apply 
)

Definition at line 11544 of file Player.cpp.

11545{
11546 if (apply)
11547 m_forcedReactions[faction_id] = rank;
11548 else
11549 m_forcedReactions.erase(faction_id);
11550}
std::map< uint32_t, Standing > m_forcedReactions
Definition Player.hpp:2228
Here is the caller graph for this function:

◆ applyItemMods()

void Player::applyItemMods ( Item item,
int16_t  slot,
bool  apply,
bool  justBrokedown = false,
bool  skipStatApply = false 
)

Definition at line 6972 of file Player.cpp.

6973{
6974 if (slot >= INVENTORY_SLOT_BAG_END)
6975 return;
6976
6977 if (!item)
6978 return;
6979
6980 ItemProperties const* itemProperties = item->getItemProperties();
6981 if (!itemProperties)
6982 return;
6983
6984 if (!item->isContainer() && !item->getDurability() && item->getMaxDurability() && justBrokedown == false)
6985 return;
6986
6987 item->applyRandomProperties(true);
6988
6989 int32_t setId = 0;
6990 if (itemProperties->ItemSet < 0)
6991 {
6992 if (sMySQLStore.getItemSetLinkedBonus(itemProperties->ItemSet) != 0)
6993 setId = sMySQLStore.getItemSetLinkedBonus(itemProperties->ItemSet);
6994 }
6995 else
6996 {
6997 setId = itemProperties->ItemSet;
6998 }
6999
7000 if (setId != 0)
7001 {
7002 if (auto itemSetEntry = sItemSetStore.lookupEntry(setId))
7003 {
7004 auto itemSetListMember = std::find_if(m_itemSets.begin(), m_itemSets.end(),
7005 [setId](ItemSet const& itemset) { return itemset.setid == setId; });
7006
7007 if (apply)
7008 {
7009 ItemSet* itemSet = nullptr;
7010
7011 // create new itemset if item has itemsetentry but not generated set stats
7012 if (itemSetListMember == m_itemSets.cend())
7013 {
7014 // push to m_itemSets if it was not available before.
7015 auto& newItemSet = m_itemSets.emplace_back(setId, 1);
7016 itemSet = &newItemSet;
7017 }
7018 else
7019 {
7020 itemSet = &(*itemSetListMember);
7021 itemSet->itemscount++;
7022 }
7023
7024 // apply spells from dbc for set
7025 if (!itemSetEntry->RequiredSkillID || (getSkillLineCurrent(static_cast<uint16_t>(itemSetEntry->RequiredSkillID), true) >= itemSetEntry->RequiredSkillAmt))
7026 {
7027 for (uint8_t itemIndex = 0; itemIndex < 8; ++itemIndex)
7028 {
7029 if (itemSet->itemscount == itemSetEntry->itemscount[itemIndex])
7030 {
7031 const auto spellInfo = sSpellMgr.getSpellInfo(itemSetEntry->SpellID[itemIndex]);
7032 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr);
7033 SpellCastTargets targets(getGuid());
7034 spell->prepare(&targets);
7035 }
7036 }
7037 }
7038 }
7039 else
7040 {
7041 if (itemSetListMember != m_itemSets.cend())
7042 {
7043 auto* itemSet = &(*itemSetListMember);
7044 for (uint8_t itemIndex = 0; itemIndex < 8; ++itemIndex)
7045 if (itemSet->itemscount == itemSetEntry->itemscount[itemIndex])
7046 removeAllAurasByIdForGuid(itemSetEntry->SpellID[itemIndex], getGuid());
7047
7048 if (!(--itemSet->itemscount))
7049 m_itemSets.erase(itemSetListMember);
7050 }
7051 }
7052 }
7053 else
7054 {
7055 sLogger.failure("Item {} has wrong ItemSet {}", itemProperties->ItemId, setId);
7056 }
7057 }
7058
7059 for (auto resistanceStat : itemProperties->resistanceStatsMap)
7060 {
7061 uint8_t spellSchool = SCHOOL_NORMAL;
7062 switch (resistanceStat.first)
7063 {
7065 spellSchool = SCHOOL_HOLY;
7066 break;
7068 spellSchool = SCHOOL_FIRE;
7069 break;
7071 spellSchool = SCHOOL_NATURE;
7072 break;
7074 spellSchool = SCHOOL_FROST;
7075 break;
7077 spellSchool = SCHOOL_SHADOW;
7078 break;
7080 spellSchool = SCHOOL_ARCANE;
7081 break;
7082 default:
7083 continue;
7084 }
7085
7086 if (apply)
7087 m_flatResistanceModifierPos[spellSchool] += resistanceStat.second;
7088 else
7089 m_flatResistanceModifierPos[spellSchool] -= resistanceStat.second;
7090
7091 calcResistance(spellSchool);
7092 }
7093
7094#if VERSION_STRING > TBC
7095 if (itemProperties->ScalingStatsEntry != 0)
7096 {
7097 calculateHeirloomBonus(itemProperties, slot, apply);
7098 }
7099 else
7100#endif
7101 {
7102 // apply general stat mods
7103 for (auto stats : itemProperties->generalStatsMap)
7104 modifyBonuses(stats.first, stats.second, apply);
7105
7106 if (itemProperties->Armor)
7107 {
7108 if (apply)
7109 m_baseResistance[0] += itemProperties->Armor;
7110 else
7111 m_baseResistance[0] -= itemProperties->Armor;
7112 calcResistance(0);
7113 }
7114
7115 if (itemProperties->Damage[0].Min)
7116 {
7117 if (itemProperties->InventoryType == INVTYPE_RANGED || itemProperties->InventoryType == INVTYPE_RANGEDRIGHT || itemProperties->InventoryType == INVTYPE_THROWN)
7118 {
7119 m_baseRangedDamage[0] += apply ? itemProperties->Damage[0].Min : -itemProperties->Damage[0].Min;
7120 m_baseRangedDamage[1] += apply ? itemProperties->Damage[0].Max : -itemProperties->Damage[0].Max;
7121 }
7122 else
7123 {
7124 if (slot == EQUIPMENT_SLOT_OFFHAND)
7125 {
7126 m_baseOffhandDamage[0] = apply ? itemProperties->Damage[0].Min : 0;
7127 m_baseOffhandDamage[1] = apply ? itemProperties->Damage[0].Max : 0;
7128 }
7129 else
7130 {
7131 m_baseDamage[0] = apply ? itemProperties->Damage[0].Min : 0;
7132 m_baseDamage[1] = apply ? itemProperties->Damage[0].Max : 0;
7133 }
7134 }
7135 }
7136 }
7137
7138 if (this->getClass() == DRUID && slot == EQUIPMENT_SLOT_MAINHAND)
7139 {
7140 uint8_t shapeShiftForm = getShapeShiftForm();
7141 if (shapeShiftForm == FORM_MOONKIN || shapeShiftForm == FORM_CAT || shapeShiftForm == FORM_BEAR || shapeShiftForm == FORM_DIREBEAR)
7142 this->applyFeralAttackPower(apply, item);
7143 }
7144
7145 if (apply)
7146 {
7148
7149 for (auto itemSpell : item->getItemProperties()->Spells)
7150 {
7151 if (itemSpell.Id == 0)
7152 continue;
7153
7154 if (auto spellInfo = sSpellMgr.getSpellInfo(itemSpell.Id))
7155 {
7156 if (itemSpell.Trigger == ON_EQUIP)
7157 {
7158 if (spellInfo->getRequiredShapeShift())
7159 {
7160 addShapeShiftSpell(spellInfo->getId());
7161 continue;
7162 }
7163
7164 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr);
7165 SpellCastTargets targets(getGuid());
7166 spell->castedItemId = item->getEntry();
7167 spell->prepare(&targets);
7168
7169 }
7170 else if (itemSpell.Trigger == CHANCE_ON_HIT)
7171 {
7172 // Calculate proc chance equivalent of 1 PPM
7173 // On average 'chance on hit' effects on items seem to have 1 proc-per-minute
7174 const auto procChance = Util::float2int32((item->getItemProperties()->Delay * 0.001f / 60.0f) * 100.0f);
7175 switch (slot)
7176 {
7177 // 'Chance on hit' in main hand should only proc from main hand hits
7179 addProcTriggerSpell(spellInfo, nullptr, getGuid(), procChance, SpellProcFlags(PROC_ON_DONE_MELEE_HIT | PROC_ON_DONE_MELEE_SPELL_HIT), EXTRA_PROC_ON_MAIN_HAND_HIT_ONLY, nullptr, nullptr, nullptr, this);
7180 break;
7181 // 'Chance on hit' in off hand should only proc from off hand hits
7184 break;
7185 // 'Chance on hit' in ranged slot should only proc from ranged attacks
7187 addProcTriggerSpell(spellInfo, nullptr, getGuid(), procChance, SpellProcFlags(PROC_ON_DONE_RANGED_HIT | PROC_ON_DONE_RANGED_SPELL_HIT), EXTRA_PROC_NULL, nullptr, nullptr, nullptr, this);
7188 break;
7189 // In any other slot, proc on any melee or ranged hit
7190 default:
7192 break;
7193 }
7194 }
7195 }
7196 }
7197 }
7198 else
7199 {
7201 for (auto itemSpell : item->getItemProperties()->Spells)
7202 {
7203 if (itemSpell.Trigger == ON_EQUIP)
7204 {
7205 if (auto spellInfo = sSpellMgr.getSpellInfo(itemSpell.Id))
7206 {
7207 if (spellInfo->getRequiredShapeShift())
7208 removeShapeShiftSpell(spellInfo->getId());
7209 else
7210 removeAllAurasById(itemSpell.Id);
7211 }
7212 }
7213 else if (itemSpell.Trigger == CHANCE_ON_HIT)
7214 {
7215 this->removeProcTriggerSpell(itemSpell.Id);
7216 }
7217 }
7218 }
7219
7220 if (!apply)
7221 {
7222 for (uint16_t posIndex = AuraSlots::POSITIVE_SLOT_START; posIndex < AuraSlots::POSITIVE_SLOT_END; ++posIndex)
7223 {
7224 if (auto* const m_aura = this->getAuraWithAuraSlot(posIndex))
7225 if (m_aura->m_castedItemId && m_aura->m_castedItemId == itemProperties->ItemId)
7226 m_aura->removeAura();
7227 }
7228 }
7229
7230 if (!skipStatApply)
7231 updateStats();
7232}
@ CHANCE_ON_HIT
@ ON_EQUIP
@ EQUIPMENT_SLOT_OFFHAND
@ EQUIPMENT_SLOT_RANGED
@ ITEM_MOD_HOLY_RESISTANCE
@ ITEM_MOD_NATURE_RESISTANCE
@ ITEM_MOD_FROST_RESISTANCE
@ ITEM_MOD_SHADOW_RESISTANCE
@ ITEM_MOD_FIRE_RESISTANCE
@ ITEM_MOD_ARCANE_RESISTANCE
@ INVTYPE_RANGED
@ INVTYPE_THROWN
@ INVTYPE_RANGEDRIGHT
@ DRUID
@ EXTRA_PROC_NULL
Definition ProcFlags.hpp:48
@ EXTRA_PROC_ON_MAIN_HAND_HIT_ONLY
Definition ProcFlags.hpp:49
@ EXTRA_PROC_ON_OFF_HAND_HIT_ONLY
Definition ProcFlags.hpp:50
SpellProcFlags
Definition ProcFlags.hpp:11
@ PROC_ON_DONE_MELEE_HIT
Definition ProcFlags.hpp:16
@ PROC_ON_DONE_RANGED_HIT
Definition ProcFlags.hpp:21
@ PROC_ON_DONE_OFFHAND_ATTACK
Definition ProcFlags.hpp:41
@ PROC_ON_DONE_MELEE_SPELL_HIT
Definition ProcFlags.hpp:18
@ PROC_ON_DONE_RANGED_SPELL_HIT
Definition ProcFlags.hpp:23
@ SCHOOL_FIRE
Definition School.hpp:14
@ SCHOOL_SHADOW
Definition School.hpp:17
@ SCHOOL_NORMAL
Definition School.hpp:12
@ SCHOOL_NATURE
Definition School.hpp:15
@ SCHOOL_ARCANE
Definition School.hpp:18
@ SCHOOL_FROST
Definition School.hpp:16
@ SCHOOL_HOLY
Definition School.hpp:13
@ FORM_DIREBEAR
@ FORM_MOONKIN
@ FORM_CAT
@ FORM_BEAR
SERVER_DECL WDB::WDBContainer< WDB::Structures::ItemSetEntry > sItemSetStore
Definition WDBStores.cpp:84
void applyAllEnchantmentBonuses()
Definition Item.cpp:389
uint32_t getDurability() const
Definition Item.cpp:216
uint32_t getMaxDurability() const
Definition Item.cpp:219
void removeAllEnchantmentBonuses()
Definition Item.cpp:398
void applyRandomProperties(bool apply)
Definition Item.cpp:671
bool isContainer() const
Definition Object.cpp:574
std::list< ItemSet > m_itemSets
Definition Player.hpp:1154
uint16_t getSkillLineCurrent(uint16_t skillLine, bool includeBonus=true) const
Definition Player.cpp:4928
void applyFeralAttackPower(bool apply, Item *item=NULL)
Definition Player.cpp:13337
void addShapeShiftSpell(uint32_t spellId)
Definition Player.cpp:4061
uint32_t m_flatResistanceModifierPos[TOTAL_SPELL_SCHOOLS]
Definition Player.hpp:2051
void calcResistance(uint8_t type)
Definition Player.cpp:15839
void removeShapeShiftSpell(uint32_t spellId)
Definition Player.cpp:4074
uint32_t castedItemId
Definition Spell.hpp:684
void removeProcTriggerSpell(uint32_t spellId, uint64_t casterGuid=0, uint64_t misc=0)
Definition Unit.cpp:3773
float m_baseRangedDamage[2]
Definition Unit.hpp:1398
float m_baseOffhandDamage[2]
Definition Unit.hpp:1394
float m_baseDamage[2]
Definition Unit.hpp:1390
SpellProc * addProcTriggerSpell(uint32_t spellId, uint32_t originalSpellId, uint64_t casterGuid, uint32_t procChance, SpellProcFlags procFlags, SpellExtraProcFlags exProcFlags, uint32_t const *spellFamilyMask, uint32_t const *procClassMask=nullptr, Aura *createdByAura=nullptr, Object *obj=nullptr)
Definition Unit.cpp:3713
uint8_t getShapeShiftForm() const
Definition Unit.cpp:1386
uint32_t m_baseResistance[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1442
@ POSITIVE_SLOT_START
Definition AuraSlots.hpp:21
@ POSITIVE_SLOT_END
Definition AuraSlots.hpp:22
void apply(T *val)
int32_t float2int32(float value)
Definition Narrow.cpp:18
auto first(const T &value, const Tail &...) -> const T &
Definition compile.h:60
uint32_t ScalingStatsEntry
uint32_t itemscount
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyItemProficienciesFromSpell()

void Player::applyItemProficienciesFromSpell ( SpellInfo const spellInfo,
bool  apply 
)

Definition at line 5253 of file Player.cpp.

5254{
5255 if (spellInfo == nullptr)
5256 return;
5257
5258 uint16_t skillId = 0;
5259 const auto skill_line_ability = sSpellMgr.getFirstSkillEntryForSpell(spellInfo->getId());
5260 if (skill_line_ability != nullptr)
5261 skillId = static_cast<uint16_t>(skill_line_ability->skilline);
5262
5263 const auto skill_line = sSkillLineStore.lookupEntry(skillId);
5264 if (skill_line == nullptr)
5265 return;
5266
5267 const auto subclass = spellInfo->getEquippedItemSubClass();
5268 if (apply)
5269 {
5270 // Add the skill to player if player does not have it
5271 // addSkillLine will set correct maximum skill value
5272 if (!hasSkillLine(skillId))
5273 addSkillLine(skillId, 1, 0);
5274
5275 if (spellInfo->getEquippedItemClass() == ITEM_CLASS_ARMOR && !(getArmorProficiency() & subclass))
5276 {
5277 addArmorProficiency(subclass);
5279 }
5280 else if (spellInfo->getEquippedItemClass() == ITEM_CLASS_WEAPON && !(getWeaponProficiency() & subclass))
5281 {
5282 addWeaponProficiency(subclass);
5284 }
5285 }
5286 else
5287 {
5288 if (hasSkillLine(skillId))
5289 removeSkillLine(skillId);
5290
5291 if (spellInfo->getEquippedItemClass() == ITEM_CLASS_ARMOR && getArmorProficiency() & subclass)
5292 {
5293 removeArmorProficiency(subclass);
5295 }
5296 else if (spellInfo->getEquippedItemClass() == ITEM_CLASS_WEAPON && getWeaponProficiency() & subclass)
5297 {
5298 removeWeaponProficiency(subclass);
5300 }
5301 }
5302}
@ ITEM_CLASS_ARMOR
@ ITEM_CLASS_WEAPON
void sendSetProficiencyPacket(uint8_t itemClass, uint32_t proficiency)
Definition Player.cpp:9601
void addArmorProficiency(uint32_t proficiency)
Definition Player.cpp:5228
void removeArmorProficiency(uint32_t proficiency)
Definition Player.cpp:5233
uint32_t getArmorProficiency() const
Definition Player.cpp:5223
uint32_t getWeaponProficiency() const
Definition Player.cpp:5238
void removeWeaponProficiency(uint32_t proficiency)
Definition Player.cpp:5248
void addWeaponProficiency(uint32_t proficiency)
Definition Player.cpp:5243
void removeSkillLine(uint16_t skillLine)
Definition Player.cpp:5068
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyLevelInfo()

void Player::applyLevelInfo ( uint32_t  newLevel)

Definition at line 2669 of file Player.cpp.

2670{
2671 const auto previousLevel = getLevel();
2672
2673 if (!m_firstLogin)
2674 {
2675 const auto previousLevelInfo = m_levelInfo;
2676
2677 m_levelInfo = sObjectMgr.getLevelInfo(getRace(), getClass(), newLevel);
2678 if (m_levelInfo == nullptr)
2679 return;
2680
2681 if (isDead())
2682 resurrect();
2683
2684 setLevel(newLevel);
2685
2688
2689 for (uint8_t i = 0; i < STAT_COUNT; ++i)
2690 {
2691 m_baseStats[i] = m_levelInfo->Stat[i];
2692 calcStat(i);
2693 }
2694
2695#if VERSION_STRING >= WotLK
2696 for (uint8_t i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
2697 if (Item* pItem = getItemInterface()->GetInventoryItem(i))
2698 applyItemMods(pItem, i, true, false, true);
2699#endif
2700 updateStats();
2701
2703
2707#if VERSION_STRING >= WotLK
2709#endif
2710
2712 newLevel,
2713 m_levelInfo->HP - previousLevelInfo->HP,
2714 m_levelInfo->Mana - previousLevelInfo->Mana,
2715 m_levelInfo->Stat[STAT_STRENGTH] - previousLevelInfo->Stat[STAT_STRENGTH],
2716 m_levelInfo->Stat[STAT_AGILITY] - previousLevelInfo->Stat[STAT_AGILITY],
2717 m_levelInfo->Stat[STAT_STAMINA] - previousLevelInfo->Stat[STAT_STAMINA],
2718 m_levelInfo->Stat[STAT_INTELLECT] - previousLevelInfo->Stat[STAT_INTELLECT],
2719 m_levelInfo->Stat[STAT_SPIRIT] - previousLevelInfo->Stat[STAT_SPIRIT]);
2720 }
2721
2722#if VERSION_STRING >= TBC
2723 // Classic does not have any level dependant flight paths
2725#endif
2726
2728
2729 if (newLevel > previousLevel || m_firstLogin)
2731 else if (newLevel != previousLevel)
2733
2734 m_playerInfo->lastLevel = previousLevel;
2735
2736#if VERSION_STRING >= WotLK
2737 updateGlyphs();
2738 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
2739#endif
2740
2741 if (m_firstLogin)
2742 sHookInterface.OnFirstEnterWorld(this);
2743 else
2744 sHookInterface.OnPostLevelUp(this);
2745
2746 if (getClass() == WARLOCK)
2747 {
2748 const auto pet = getPet();
2749 if (pet != nullptr && pet->IsInWorld() && pet->isAlive())
2750 {
2751 pet->setLevel(newLevel);
2752 pet->applyStatsForLevel();
2753 pet->updateSpellList();
2754 }
2755 }
2756
2757 smsg_TalentsInfo(false);
2758
2759 m_playedTime[0] = 0;
2760}
@ WARLOCK
@ POWER_TYPE_RUNES
Definition PowerType.hpp:23
@ POWER_TYPE_FOCUS
Definition PowerType.hpp:15
@ POWER_TYPE_MANA
Definition PowerType.hpp:13
@ POWER_TYPE_ENERGY
Definition PowerType.hpp:16
@ STAT_SPIRIT
Definition Stats.h:37
@ STAT_INTELLECT
Definition Stats.h:36
@ STAT_COUNT
Definition Stats.h:38
@ STAT_AGILITY
Definition Stats.h:34
@ STAT_STRENGTH
Definition Stats.h:33
@ STAT_STAMINA
Definition Stats.h:35
bool m_firstLogin
Definition Player.hpp:1982
LevelInfo const * m_levelInfo
Definition Player.hpp:725
void smsg_TalentsInfo(bool SendPetTalents)
Definition Player.cpp:6152
CachedCharacterInfo * m_playerInfo
Definition Player.hpp:747
void initTaxiNodesForLevel()
Definition Player.cpp:10780
void sendLevelupInfoPacket(uint32_t level, uint32_t hp, uint32_t mana, uint32_t stat0, uint32_t stat1, uint32_t stat2, uint32_t stat3, uint32_t stat4)
Definition Player.cpp:9719
void updateSkillMaximumValues()
Definition Player.cpp:5168
uint32_t m_playedTime[3]
Definition Player.hpp:743
void resetAllTalents()
Definition Player.cpp:5996
void resurrect()
Definition Player.cpp:7671
void calcStat(uint8_t t)
Definition Player.cpp:15895
uint32_t getMaxPower(PowerType type) const
Definition Unit.cpp:654
void setBaseHealth(uint32_t baseHealth)
Definition Unit.cpp:1474
uint32_t getMaxHealth() const
Definition Unit.cpp:625
void setHealth(uint32_t health)
Definition Unit.cpp:482
uint8_t getRace() const
Definition Unit.cpp:453
void setLevel(uint32_t level)
Definition Unit.cpp:937
uint32_t m_baseStats[5]
Definition Unit.hpp:1443
void setBaseMana(uint32_t baseMana)
Definition Unit.cpp:1471
bool isDead() const
Definition Unit.cpp:7872
uint32_t Stat[5]
uint32_t Mana
uint32_t HP
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyPlayerRestState()

void Player::applyPlayerRestState ( bool  apply)

Definition at line 12245 of file Player.cpp.

12246{
12247 if (apply)
12248 {
12250 m_isResting = true;
12252 }
12253 else
12254 {
12255 m_isResting = false;
12257 }
12258
12260}
@ RESTSTATE_RESTED
@ PLAYER_FLAG_RESTING
void addPlayerFlags(uint32_t flags)
Definition Player.cpp:784
void removePlayerFlags(uint32_t flags)
Definition Player.cpp:785
uint8_t m_restState
Definition Player.hpp:1750
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyRandomBattlegroundReward()

void Player::applyRandomBattlegroundReward ( bool  wonBattleground)

Definition at line 8607 of file Player.cpp.

8608{
8609 uint32_t honorPoints, arenaPoints;
8610 this->fillRandomBattlegroundReward(wonBattleground, honorPoints, arenaPoints);
8611 this->addHonor(honorPoints, false);
8612 this->addArenaPoints(arenaPoints, false);
8613 this->updatePvPCurrencies();
8614}
void addHonor(uint32_t honorPoints, bool sendUpdate)
Definition Player.cpp:8133
void addArenaPoints(uint32_t arenaPoints, bool sendUpdate)
Definition Player.cpp:8092
void updatePvPCurrencies()
Definition Player.cpp:8509
void fillRandomBattlegroundReward(bool wonBattleground, uint32_t &honorPoints, uint32_t &arenaPoints)
Definition Player.cpp:8583
Here is the call graph for this function:

◆ applyReforgeEnchantment()

void Player::applyReforgeEnchantment ( Item item,
bool  apply 
)

Definition at line 9922 of file Player.cpp.

9923{
9924 if (!item)
9925 return;
9926
9927 WDB::Structures::ItemReforgeEntry const* reforge = sItemReforgeStore.lookupEntry(item->getEnchantmentId(REFORGE_ENCHANTMENT_SLOT));
9928 if (!reforge)
9929 return;
9930
9931 auto removeValue = static_cast<int32_t>(item->getReforgableStat(ItemModType(reforge->SourceStat)) * reforge->SourceMultiplier);
9932 auto addValue = static_cast<int32_t>(removeValue * reforge->FinalMultiplier);
9933
9934 switch (reforge->SourceStat)
9935 {
9936 case ITEM_MOD_MANA:
9937 modifyBonuses(ITEM_MOD_MANA, -removeValue, apply);
9938 break;
9939 case ITEM_MOD_HEALTH:
9940 modifyBonuses(ITEM_MOD_HEALTH, -removeValue, apply);
9941 break;
9942 case ITEM_MOD_AGILITY:
9943 modifyBonuses(ITEM_MOD_AGILITY, -removeValue, apply);
9944 break;
9945 case ITEM_MOD_STRENGTH:
9946 modifyBonuses(ITEM_MOD_STRENGTH, -removeValue, apply);
9947 break;
9948 case ITEM_MOD_INTELLECT:
9949 modifyBonuses(ITEM_MOD_INTELLECT, -removeValue, apply);
9950 break;
9951 case ITEM_MOD_SPIRIT:
9952 modifyBonuses(ITEM_MOD_SPIRIT, -removeValue, apply);
9953 break;
9954 case ITEM_MOD_STAMINA:
9955 modifyBonuses(ITEM_MOD_STAMINA, -removeValue, apply);
9956 break;
9958 modifyBonuses(ITEM_MOD_DEFENSE_RATING, -removeValue, apply);
9959 break;
9961 modifyBonuses(ITEM_MOD_DODGE_RATING, -removeValue, apply);
9962 break;
9964 modifyBonuses(ITEM_MOD_PARRY_RATING, -removeValue, apply);
9965 break;
9967 modifyBonuses(ITEM_MOD_SHIELD_BLOCK_RATING, -removeValue, apply);
9968 break;
9970 modifyBonuses(ITEM_MOD_MELEE_HIT_RATING, -removeValue, apply);
9971 break;
9973 modifyBonuses(ITEM_MOD_RANGED_HIT_RATING, -removeValue, apply);
9974 break;
9976 modifyBonuses(ITEM_MOD_SPELL_HIT_RATING, -removeValue, apply);
9977 break;
9980 break;
9983 break;
9986 break;
9988 modifyBonuses(ITEM_MOD_SPELL_HASTE_RATING, -removeValue, apply);
9989 break;
9991 modifyBonuses(ITEM_MOD_HIT_RATING, -removeValue, apply);
9992 break;
9994 modifyBonuses(ITEM_MOD_CRITICAL_STRIKE_RATING, -removeValue, apply);
9995 break;
9997 modifyBonuses(ITEM_MOD_RESILIENCE_RATING, -removeValue, apply);
9998 break;
10000 modifyBonuses(ITEM_MOD_HASTE_RATING, -removeValue, apply);
10001 break;
10003 modifyBonuses(ITEM_MOD_EXPERTISE_RATING, -removeValue, apply);
10004 break;
10006 modifyBonuses(ITEM_MOD_ATTACK_POWER, -removeValue, apply);
10007 break;
10009 modifyBonuses(ITEM_MOD_RANGED_ATTACK_POWER, -removeValue, apply);
10010 break;
10012 modifyBonuses(ITEM_MOD_MANA_REGENERATION , -removeValue, apply);
10013 break;
10016 break;
10018 modifyBonuses(ITEM_MOD_SPELL_POWER , -removeValue, apply);
10019 break;
10020 /*case ITEM_MOD_HEALTH_REGEN: // todo dunno where these are handled
10021 -int32_t(removeValue)
10022 break;
10023 case ITEM_MOD_SPELL_PENETRATION:
10024 -int32_t(removeValue)
10025 break;
10026 case ITEM_MOD_BLOCK_VALUE:
10027 -removeValue
10028 break;*/
10029 }
10030
10031 switch (reforge->FinalStat)
10032 {
10033 case ITEM_MOD_MANA:
10034 modifyBonuses(ITEM_MOD_MANA, addValue, apply);
10035 break;
10036 case ITEM_MOD_HEALTH:
10037 modifyBonuses(ITEM_MOD_HEALTH, addValue, apply);
10038 break;
10039 case ITEM_MOD_AGILITY:
10040 modifyBonuses(ITEM_MOD_AGILITY, addValue, apply);
10041 break;
10042 case ITEM_MOD_STRENGTH:
10043 modifyBonuses(ITEM_MOD_STRENGTH, addValue, apply);
10044 break;
10045 case ITEM_MOD_INTELLECT:
10046 modifyBonuses(ITEM_MOD_INTELLECT, addValue, apply);
10047 break;
10048 case ITEM_MOD_SPIRIT:
10049 modifyBonuses(ITEM_MOD_SPIRIT, addValue, apply);
10050 break;
10051 case ITEM_MOD_STAMINA:
10052 modifyBonuses(ITEM_MOD_STAMINA, addValue, apply);
10053 break;
10055 modifyBonuses(ITEM_MOD_DEFENSE_RATING, addValue, apply);
10056 break;
10058 modifyBonuses(ITEM_MOD_DODGE_RATING, addValue, apply);
10059 break;
10061 modifyBonuses(ITEM_MOD_PARRY_RATING, addValue, apply);
10062 break;
10065 break;
10067 modifyBonuses(ITEM_MOD_MELEE_HIT_RATING, addValue, apply);
10068 break;
10070 modifyBonuses(ITEM_MOD_RANGED_HIT_RATING, addValue, apply);
10071 break;
10073 modifyBonuses(ITEM_MOD_SPELL_HIT_RATING, addValue, apply);
10074 break;
10077 break;
10080 break;
10083 break;
10086 break;
10088 modifyBonuses(ITEM_MOD_HIT_RATING, addValue, apply);
10089 break;
10092 break;
10094 modifyBonuses(ITEM_MOD_RESILIENCE_RATING, addValue, apply);
10095 break;
10097 modifyBonuses(ITEM_MOD_HASTE_RATING, addValue, apply);
10098 break;
10100 modifyBonuses(ITEM_MOD_EXPERTISE_RATING, addValue, apply);
10101 break;
10103 modifyBonuses(ITEM_MOD_ATTACK_POWER, addValue, apply);
10104 break;
10107 break;
10109 modifyBonuses(ITEM_MOD_MANA_REGENERATION, addValue, apply);
10110 break;
10112 modifyBonuses(CR_ARMOR_PENETRATION, addValue, apply);
10113 break;
10115 modifyBonuses(ITEM_MOD_SPELL_POWER, addValue, apply);
10116 break;
10117 /*case ITEM_MOD_HEALTH_REGEN: // todo dunno where these are handled
10118 int32_t(addValue)
10119 break;
10120 case ITEM_MOD_SPELL_PENETRATION:
10121 int32_t(addValue)
10122 break;
10123 case ITEM_MOD_BLOCK_VALUE:
10124 addValue
10125 break;*/
10126 }
10127
10128 updateStats();
10129}
ItemModType
@ ITEM_MOD_STAMINA
@ ITEM_MOD_PARRY_RATING
@ ITEM_MOD_MELEE_HIT_RATING
@ ITEM_MOD_RANGED_CRITICAL_STRIKE_RATING
@ ITEM_MOD_EXPERTISE_RATING
@ ITEM_MOD_MANA
@ ITEM_MOD_RANGED_ATTACK_POWER
@ ITEM_MOD_HEALTH
@ ITEM_MOD_CRITICAL_STRIKE_RATING
@ ITEM_MOD_SPIRIT
@ ITEM_MOD_SPELL_POWER
@ ITEM_MOD_ATTACK_POWER
@ ITEM_MOD_HASTE_RATING
@ ITEM_MOD_SPELL_CRITICAL_STRIKE_RATING
@ ITEM_MOD_SHIELD_BLOCK_RATING
@ ITEM_MOD_SPELL_HASTE_RATING
@ ITEM_MOD_RANGED_HIT_RATING
@ ITEM_MOD_STRENGTH
@ ITEM_MOD_ARMOR_PENETRATION_RATING
@ ITEM_MOD_DEFENSE_RATING
@ ITEM_MOD_SPELL_HIT_RATING
@ ITEM_MOD_MANA_REGENERATION
@ ITEM_MOD_HIT_RATING
@ ITEM_MOD_INTELLECT
@ ITEM_MOD_RESILIENCE_RATING
@ ITEM_MOD_AGILITY
@ ITEM_MOD_DODGE_RATING
@ ITEM_MOD_MELEE_CRITICAL_STRIKE_RATING
@ REFORGE_ENCHANTMENT_SLOT
@ CR_ARMOR_PENETRATION
int32_t getReforgableStat(ItemModType statType) const
Definition Item.cpp:1170
uint32_t getEnchantmentId(uint8_t index) const
Definition Item.cpp:193
Here is the call graph for this function:
Here is the caller graph for this function:

◆ areaExploredQuestEvent()

void Player::areaExploredQuestEvent ( uint32_t  questId)

Definition at line 8940 of file Player.cpp.

8941{
8942 sQuestMgr.AreaExplored(this, questId);
8943}
Here is the caller graph for this function:

◆ avengingWrath()

void Player::avengingWrath ( )
inline

Definition at line 2247 of file Player.hpp.

2247{ m_avengingWrath = true; }
bool m_avengingWrath
Definition Player.hpp:2248
Here is the caller graph for this function:

◆ bindToInstance() [1/2]

void Player::bindToInstance ( )

Definition at line 12903 of file Player.cpp.

12904{
12905 InstanceSaved* mapSave = sInstanceMgr.getInstanceSave(m_pendingBindId);
12906 if (!mapSave)
12907 return;
12908
12910 data << uint32_t(0);
12911 sendPacket(&data);
12912 if (!isGMFlagSet())
12913 {
12914 bindToInstance(mapSave, true, EXTEND_STATE_KEEP);
12915#if VERSION_STRING > TBC
12916 getSession()->sendCalendarRaidLockout(mapSave, true);
12917#endif
12918 }
12919}
@ EXTEND_STATE_KEEP
@ SMSG_INSTANCE_SAVE_CREATED
Definition Opcodes.hpp:782
uint32_t m_pendingBindId
Definition Player.hpp:2156
void bindToInstance()
Definition Player.cpp:12903
bool isGMFlagSet() const
Definition Player.cpp:9381
void sendCalendarRaidLockout(InstanceSaved const *save, bool add)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bindToInstance() [2/2]

InstancePlayerBind * Player::bindToInstance ( InstanceSaved save,
bool  permanent,
BindExtensionState  extendState = EXTEND_STATE_NORMAL,
bool  load = false 
)

Definition at line 12855 of file Player.cpp.

12856{
12857 if (save)
12858 {
12859 InstancePlayerBind& bind = m_boundInstances[save->getDifficulty()][save->getMapId()];
12860 if (extendState == EXTEND_STATE_KEEP) // special flag, keep the player's current extend state when updating for new boss down
12861 {
12862 if (save == bind.save)
12863 extendState = bind.extendState;
12864 else
12865 extendState = EXTEND_STATE_NORMAL;
12866 }
12867 if (!load)
12868 {
12869 if (bind.save)
12870 {
12871 // update the save when the group kills a boss
12872 if (permanent != bind.perm || save != bind.save || extendState != bind.extendState)
12873 {
12874 CharacterDatabase.Execute("UPDATE character_instance SET instance = %u, permanent = %u, extendState = %u WHERE guid = %u AND instance = %u", save->getInstanceId(), permanent, extendState, getGuidLow(), bind.save->getInstanceId());
12875 }
12876 }
12877 else
12878 {
12879 CharacterDatabase.Execute("INSERT INTO character_instance (guid, instance, permanent, extendState) VALUES (%u, %u, %u, %u)", getGuidLow(), save->getInstanceId(), permanent, extendState);
12880 }
12881 }
12882
12883 if (bind.save != save)
12884 {
12885 if (bind.save)
12886 bind.save->removePlayer(this);
12887
12888 save->addPlayer(this);
12889 }
12890
12891 if (permanent)
12892 save->setCanReset(false);
12893
12894 bind.save = save;
12895 bind.perm = permanent;
12896 bind.extendState = extendState;
12897 return &bind;
12898 }
12899
12900 return nullptr;
12901}
@ EXTEND_STATE_NORMAL
bool removePlayer(Player *player)
uint32_t getInstanceId() const
BoundInstancesMap m_boundInstances[InstanceDifficulty::MAX_DIFFICULTY]
Definition Player.hpp:2126
static void save(LexState *ls, int c)
Definition llex.c:57
BindExtensionState extendState
InstanceSaved * save
Here is the call graph for this function:
Here is the caller graph for this function:

◆ broadcastMessage()

void Player::broadcastMessage ( const char *  Format,
  ... 
)

Definition at line 6552 of file Player.cpp.

6553{
6554 va_list list;
6555 va_start(list, Format);
6556 char Message[1024];
6557 vsnprintf(Message, 1024, Format, list);
6558 va_end(list);
6559
6561}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildCreateUpdateBlockForPlayer()

uint32_t Player::buildCreateUpdateBlockForPlayer ( ByteBuffer data,
Player target 
)
overridevirtual

This includes any nested objects we have, inventory for example.

\ todo: vehicles?

Reimplemented from Object.

Definition at line 3303 of file Player.cpp.

3304{
3305 uint32_t count = 0;
3306 if (target == this)
3308
3310
3311 return count;
3312}
uint32_t m_CreateForPlayer(ByteBuffer *data)
virtual uint32_t buildCreateUpdateBlockForPlayer(ByteBuffer *data, Player *target)
This includes any nested objects we have, inventory for example.
Definition Object.cpp:421
constexpr auto count() -> size_t
Definition core.h:1222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildFlagUpdateForNonGroupSet()

void Player::buildFlagUpdateForNonGroupSet ( uint32_t  index,
uint32_t  flag 
)

Definition at line 16185 of file Player.cpp.

16186{
16187 for (const auto& inRangeObject : getInRangeObjectsSet())
16188 {
16189 if (inRangeObject && inRangeObject->isPlayer())
16190 {
16191 auto group = static_cast<Player*>(inRangeObject)->getGroup();
16192 if (!group && group != getGroup())
16193 {
16194 BuildFieldUpdatePacket(static_cast<Player*>(inRangeObject), index, flag);
16195 }
16196 }
16197 }
16198}
void BuildFieldUpdatePacket(Player *Target, uint32_t Index, uint32_t Value)
Definition Object.cpp:1782
std::vector< Object * > getInRangeObjectsSet() const
Definition Object.cpp:1573
Here is the call graph for this function:

◆ buildRepop()

void Player::buildRepop ( )

Definition at line 7711 of file Player.cpp.

7712{
7713#if VERSION_STRING > TBC
7714 getSession()->SendPacket(SmsgPreResurrect(getGuid()).serialise().get());
7715#endif
7716
7717 uint32_t AuraIds[] = { 20584, 9036, 8326, 0 };
7718 removeAllAurasById(AuraIds);
7719
7720 setHealth(1);
7721
7722 SpellCastTargets target(getGuid());
7723
7724 if (getRace() == RACE_NIGHTELF)
7725 {
7726 SpellInfo const* spellInfo = sSpellMgr.getSpellInfo(9036);
7727 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr);
7728 spell->prepare(&target);
7729 }
7730 else
7731 {
7732 SpellInfo const* spellInfo = sSpellMgr.getSpellInfo(8326);
7733 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr);
7734 spell->prepare(&target);
7735 }
7736
7740
7742
7743 setMoveRoot(false);
7745}
@ PLAYER_FLAG_DEATH_WORLD_ENABLE
@ MIRROR_TYPE_BREATH
@ MIRROR_TYPE_FATIGUE
@ MIRROR_TYPE_FIRE
@ RACE_NIGHTELF
void sendStopMirrorTimerPacket(MirrorTimerTypes type)
Definition Player.cpp:9651
void setMoveWaterWalk()
Definition Unit.cpp:1992
void setMoveRoot(bool set_root)
Definition Unit.cpp:2245
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcDeathDurabilityLoss()

void Player::calcDeathDurabilityLoss ( double  percent)

Definition at line 7747 of file Player.cpp.

7748{
7749 sendPacket(SmsgDurabilityDamageDeath(static_cast<uint32_t>(percent)).serialise().get());
7750
7751 for (uint8_t i = 0; i < EQUIPMENT_SLOT_END; ++i)
7752 {
7753 if (Item* item = getItemInterface()->GetInventoryItem(i))
7754 {
7755 const uint32_t maxDurability = item->getMaxDurability();
7756 const uint32_t durability = item->getDurability();
7757 if (durability)
7758 {
7759 int32_t newDurability = static_cast<uint32_t>(maxDurability * percent);
7760 newDurability = durability - newDurability;
7761 if (newDurability < 0)
7762 newDurability = 0;
7763
7764 if (newDurability <= 0)
7765 applyItemMods(item, i, false, true);
7766
7767 item->setDurability(static_cast<uint32_t>(newDurability));
7768 item->m_isDirty = true;
7769 }
7770 }
7771 }
7772}
@ EQUIPMENT_SLOT_END
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcExpertise()

void Player::calcExpertise ( )

Definition at line 13192 of file Player.cpp.

13193{
13194 int32_t modifier = 0;
13195
13196#if VERSION_STRING != Classic
13197 setExpertise(0);
13199
13200 for (const auto& aurEff : getAuraEffectList(SPELL_AURA_EXPERTISE))
13201 {
13202 SpellInfo const* spellInfo = aurEff->getAura()->getSpellInfo();
13203 int32_t val = aurEff->getEffectDamage();
13204
13205 if (spellInfo->getEquippedItemSubClass() != 0)
13206 {
13209
13210 uint32_t reqskillMH = 0;
13211 uint32_t reqskillOH = 0;
13212
13213 if (item_mainhand)
13214 reqskillMH = spellInfo->getEquippedItemSubClass() & (((uint32_t)1) << item_mainhand->getItemProperties()->SubClass);
13215
13216 if (item_offhand)
13217 reqskillOH = spellInfo->getEquippedItemSubClass() & (((uint32_t)1) << item_offhand->getItemProperties()->SubClass);
13218
13219 if (reqskillMH != 0 || reqskillOH != 0)
13220 modifier = +val;
13221 }
13222 else
13223 modifier += val;
13224 }
13225
13228#endif
13229 updateStats();
13230}
@ SPELL_AURA_EXPERTISE
@ CR_EXPERTISE
void modOffHandExpertise(int32_t value)
Definition Player.cpp:1097
void modExpertise(int32_t value)
Definition Player.cpp:1093
void setExpertise(uint32_t value)
Definition Player.cpp:1092
void setOffHandExpertise(uint32_t value)
Definition Player.cpp:1096
float calcRating(PlayerCombatRating t)
Definition Player.cpp:16170
int32_t getEquippedItemSubClass() const
AuraEffectList const & getAuraEffectList(AuraEffect effect) const
Definition Unit.cpp:5752
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcRating()

float Player::calcRating ( PlayerCombatRating  t)

Definition at line 16170 of file Player.cpp.

16171{
16172 uint32_t level = getLevel();
16173 if (level > 100)
16174 level = 100;
16175
16176 uint32_t rating = getCombatRating(index);
16177
16178 WDB::Structures::GtCombatRatingsEntry const* combatRatingsEntry = sGtCombatRatingsStore.lookupEntry(index * 100 + level - 1);
16179 if (combatRatingsEntry == nullptr)
16180 return float(rating);
16181
16182 return (rating / combatRatingsEntry->val);
16183}
SERVER_DECL WDB::WDBContainer< WDB::Structures::GtCombatRatingsEntry > sGtCombatRatingsStore
uint32_t getCombatRating(uint8_t combatRating) const
Definition Player.cpp:1276
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcResistance()

void Player::calcResistance ( uint8_t  type)

Definition at line 15839 of file Player.cpp.

15840{
15841 if (type < 7)
15842 {
15845
15848 int32_t res = m_baseResistance[type] + pos - neg;
15849
15850 if (type == 0)
15851 res += getStat(STAT_AGILITY) * 2; //fix armor from agi
15852
15853 if (res < 0)
15854 res = 0;
15855
15856 pos += (res * m_resistanceModPctPos[type]) / 100;
15857 neg += (res * m_resistanceModPctNeg[type]) / 100;
15858 res = pos - neg + m_baseResistance[type];
15859
15860 if (type == 0)
15861 res += getStat(STAT_AGILITY) * 2; //fix armor from agi
15862
15863#if VERSION_STRING >= WotLK
15864 // Dynamic aura 285 application, removing bonus
15866 {
15867 auto modifiableAurEff = aurEff->getAura()->getModifiableAuraEffect(aurEff->getEffectIndex());
15868 aurEff->getAura()->SpellAuraModAttackPowerOfArmor(modifiableAurEff, false);
15869 }
15870#endif
15871
15872 if (res < 0)
15873 res = 1;
15874
15875#if VERSION_STRING > Classic
15878#endif
15879 setResistance(type, res > 0 ? res : 0);
15880
15881 if (auto* const pet = getPet())
15882 pet->CalcResistance(type); //Re-calculate pet's too.
15883
15884#if VERSION_STRING >= WotLK
15885 // Dynamic aura 285 application, adding bonus
15887 {
15888 auto modifiableAurEff = aurEff->getAura()->getModifiableAuraEffect(aurEff->getEffectIndex());
15889 aurEff->getAura()->SpellAuraModAttackPowerOfArmor(modifiableAurEff, true);
15890 }
15891#endif
15892 }
15893}
@ SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
uint32_t m_resistanceModPctNeg[TOTAL_SPELL_SCHOOLS]
Definition Player.hpp:2056
uint32_t m_flatResistanceModifierNeg[TOTAL_SPELL_SCHOOLS]
Definition Player.hpp:2052
void setResistanceBuffModPositive(uint8_t type, uint32_t value)
Definition Player.cpp:1195
uint32_t m_baseResistanceModPctPos[TOTAL_SPELL_SCHOOLS]
Definition Player.hpp:2053
uint32_t m_resistanceModPctPos[TOTAL_SPELL_SCHOOLS]
Definition Player.hpp:2055
void setResistanceBuffModNegative(uint8_t type, uint32_t value)
Definition Player.cpp:1198
uint32_t m_baseResistanceModPctNeg[TOTAL_SPELL_SCHOOLS]
Definition Player.hpp:2054
uint32_t getStat(uint8_t stat) const
Definition Unit.cpp:1448
void setResistance(uint8_t type, uint32_t value)
Definition Unit.cpp:1460
static int neg(void *a, void *b)
Definition ltm_desc.c:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcStat()

void Player::calcStat ( uint8_t  t)

Definition at line 15895 of file Player.cpp.

15896{
15897 if (type < 5)
15898 {
15901 int32_t res = pos + (int32_t)m_baseStats[type] - neg;
15902 if (res <= 0)
15903 res = 1;
15904
15905 pos += (res * (int32_t)this->m_totalStatModPctPos[type]) / 100;
15906 neg += (res * (int32_t)this->m_totalStatModPctNeg[type]) / 100;
15907 res = pos + m_baseStats[type] - neg;
15908 if (res <= 0)
15909 res = 1;
15910
15911#if VERSION_STRING != Classic
15912 setPosStat(type, pos);
15913
15914 if (neg < 0)
15915 setNegStat(type, -neg);
15916 else
15917 setNegStat(type, neg);
15918#endif
15919
15920 setStat(type, res);
15921 if (type == STAT_AGILITY)
15922 calcResistance(0);
15923
15924 if (type == STAT_STAMINA || type == STAT_INTELLECT)
15925 {
15926 if (auto* const pet = getPet())
15927 pet->CalcStat(type); //Re-calculate pet's too
15928 }
15929 }
15930}
uint32_t m_flatStatModPos[5]
Definition Player.hpp:2070
uint32_t m_flatStatModNeg[5]
Definition Player.hpp:2071
uint32_t m_statModPctPos[5]
Definition Player.hpp:2072
uint32_t m_totalStatModPctPos[5]
Definition Player.hpp:2074
uint32_t m_statModPctNeg[5]
Definition Player.hpp:2073
uint32_t m_totalStatModPctNeg[5]
Definition Player.hpp:2075
void setStat(uint8_t stat, uint32_t value)
Definition Unit.cpp:1449
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcTalentResetCost()

uint32_t Player::calcTalentResetCost ( uint32_t  resetnum) const

Definition at line 6321 of file Player.cpp.

6322{
6323 if (resetnum == 0)
6324 return 10000;
6325
6326 if (resetnum > 10)
6327 return 500000;
6328
6329 return resetnum * 50000;
6330}
Here is the caller graph for this function:

◆ calculateDamage()

void Player::calculateDamage ( )
overridevirtual

Reimplemented from Unit.

Definition at line 16612 of file Player.cpp.

16613{
16614 float rangeDamage;
16615
16616 // Mainhand
16617 float attackPowerBonus = getCalculatedAttackPower() / 14000.0f;
16619
16620 if (isInFeralForm())
16621 {
16622 float damageMod = 1;
16623 for (std::map<uint32_t, WeaponModifier>::iterator i = m_damageDone.begin(); i != m_damageDone.end(); ++i)
16624 {
16625 if (i->second.wclass == (uint32_t)-1) // applying only "any weapon" modifiers
16626 damageMod += i->second.value;
16627 }
16628
16629 uint32_t level = getLevel();
16630 float averageFeralDamage;
16631 uint32_t itemLeven; // the two hand weapon with dps equal to cat or bear dps
16632
16633 uint8_t shapeShiftForm = getShapeShiftForm();
16634 if (shapeShiftForm == FORM_CAT)
16635 {
16636 if (level < 42)
16637 itemLeven = level - 1;
16638 else if (level < 46)
16639 itemLeven = level;
16640 else if (level < 49)
16641 itemLeven = 2 * level - 45;
16642 else if (level < 60)
16643 itemLeven = level + 4;
16644 else
16645 itemLeven = 64;
16646
16647 // 3rd grade polinom for calculating blue two-handed weapon dps based on itemlevel
16648 if (itemLeven <= 28)
16649 averageFeralDamage = 1.563e-03f * itemLeven * itemLeven * itemLeven - 1.219e-01f * itemLeven * itemLeven + 3.802e+00f * itemLeven - 2.227e+01f;
16650 else if (itemLeven <= 41)
16651 averageFeralDamage = -3.817e-03f * itemLeven * itemLeven * itemLeven + 4.015e-01f * itemLeven * itemLeven - 1.289e+01f * itemLeven + 1.530e+02f;
16652 else
16653 averageFeralDamage = 1.829e-04f * itemLeven * itemLeven * itemLeven - 2.692e-02f * itemLeven * itemLeven + 2.086e+00f * itemLeven - 1.645e+01f;
16654
16655 rangeDamage = averageFeralDamage * 0.79f + deltaDone + attackPowerBonus * 1000.0f;
16656 rangeDamage *= damageMod;
16657 setMinDamage(rangeDamage > 0 ? rangeDamage : 0);
16658
16659 rangeDamage = averageFeralDamage * 1.21f + deltaDone + attackPowerBonus * 1000.0f;
16660 rangeDamage *= damageMod;
16661 setMaxDamage(rangeDamage > 0 ? rangeDamage : 0);
16662 }
16663 else // Bear or Dire Bear Form
16664 {
16665 if (shapeShiftForm == FORM_BEAR)
16666 itemLeven = level;
16667 else
16668 itemLeven = level + 5; // DIRE_BEAR dps is slightly better than bear dps
16669
16670 if (itemLeven > 70)
16671 itemLeven = 70;
16672
16673 // 3rd grade polinom for calculating green two-handed weapon dps based on itemlevel
16674 if (itemLeven <= 30)
16675 averageFeralDamage = 7.638e-05f * itemLeven * itemLeven * itemLeven + 1.874e-03f * itemLeven * itemLeven + 4.967e-01f * itemLeven + 1.906e+00f;
16676 else if (itemLeven <= 44)
16677 averageFeralDamage = -1.412e-03f * itemLeven * itemLeven * itemLeven + 1.870e-01f * itemLeven * itemLeven - 7.046e+00f * itemLeven + 1.018e+02f;
16678 else
16679 averageFeralDamage = 2.268e-04f * itemLeven * itemLeven * itemLeven - 3.704e-02f * itemLeven * itemLeven + 2.784e+00f * itemLeven - 3.616e+01f;
16680
16681 averageFeralDamage *= 2.5f; // Bear Form attack speed
16682
16683 rangeDamage = averageFeralDamage * 0.79f + deltaDone + attackPowerBonus * 2500.0f;
16684 rangeDamage *= damageMod;
16685 setMinDamage(rangeDamage > 0 ? rangeDamage : 0);
16686
16687 rangeDamage = averageFeralDamage * 1.21f + deltaDone + attackPowerBonus * 2500.0f;
16688 rangeDamage *= damageMod;
16689 setMaxDamage(rangeDamage > 0 ? rangeDamage : 0);
16690 }
16691
16692 return;
16693 }
16694
16695 // no druid shapeShift
16696 uint32_t speed = 2000;
16698
16699 if (item && !m_isDisarmed)
16700 speed = item->getItemProperties()->Delay;
16701
16702 float bonus = attackPowerBonus * speed;
16703 float damageMod = 1;
16704 for (std::map<uint32_t, WeaponModifier>::iterator weaponMod = m_damageDone.begin(); weaponMod != m_damageDone.end(); ++weaponMod)
16705 {
16706 if ((weaponMod->second.wclass == (uint32_t)-1) || //any weapon
16707 (item && ((1 << item->getItemProperties()->SubClass) & weaponMod->second.subclass)))
16708 damageMod += weaponMod->second.value;
16709 }
16710
16711 rangeDamage = m_baseDamage[0] + deltaDone + bonus;
16712 rangeDamage *= damageMod;
16713 setMinDamage(rangeDamage > 0 ? rangeDamage : 0);
16714
16715 rangeDamage = m_baseDamage[1] + deltaDone + bonus;
16716 rangeDamage *= damageMod;
16717 setMaxDamage(rangeDamage > 0 ? rangeDamage : 0);
16718
16719 uint32_t cr = 0;
16720 if (item)
16721 {
16722 if (this->m_wratings.size())
16723 {
16724 std::map<uint32_t, uint32_t>::iterator itr = m_wratings.find(item->getItemProperties()->SubClass);
16725 if (itr != m_wratings.end())
16726 cr = itr->second;
16727 }
16728 }
16729 //\todo investigate
16730#if VERSION_STRING != Classic
16732#endif
16733 // Mainhand END
16734
16735 // Offhand START
16736 cr = 0;
16738 if (item)
16739 {
16740 if (!m_isDisarmed)
16741 speed = item->getItemProperties()->Delay;
16742 else
16743 speed = 2000;
16744
16745 bonus = attackPowerBonus * speed;
16746
16747 damageMod = 1;
16748 for (std::map<uint32_t, WeaponModifier>::iterator i = m_damageDone.begin(); i != m_damageDone.end(); ++i)
16749 {
16750 if ((i->second.wclass == (uint32_t)-1) || //any weapon
16751 (((1 << item->getItemProperties()->SubClass) & i->second.subclass))
16752 )
16753 damageMod += i->second.value;
16754 }
16755
16756 rangeDamage = (m_baseOffhandDamage[0] + deltaDone + bonus) * m_offhandDmgMod;
16757 rangeDamage *= damageMod;
16758 setMinOffhandDamage(rangeDamage > 0 ? rangeDamage : 0);
16759
16760 rangeDamage = (m_baseOffhandDamage[1] + deltaDone + bonus) * m_offhandDmgMod;
16761 rangeDamage *= damageMod;
16762 setMaxOffhandDamage(rangeDamage > 0 ? rangeDamage : 0);
16763
16764 if (m_wratings.size())
16765 {
16766 std::map<uint32_t, uint32_t>::iterator itr = m_wratings.find(item->getItemProperties()->SubClass);
16767 if (itr != m_wratings.end())
16768 cr = itr->second;
16769 }
16770 }
16771 //\todo investigate
16772#if VERSION_STRING != Classic
16774#endif
16775 // Offhand END
16776 // Ranged
16777 cr = 0;
16779 if (item)
16780 {
16781 damageMod = 1;
16782 for (std::map<uint32_t, WeaponModifier>::iterator weaponMod = m_damageDone.begin(); weaponMod != m_damageDone.end(); ++weaponMod)
16783 {
16784 if ((weaponMod->second.wclass == (uint32_t)-1) || //any weapon
16785 (((1 << item->getItemProperties()->SubClass) & weaponMod->second.subclass)))
16786 {
16787 damageMod += weaponMod->second.value;
16788 }
16789 }
16790
16791#if VERSION_STRING < Cata
16792 if (item->getItemProperties()->SubClass != 19)//wands do not have bonuses from RAP & ammo
16793 {
16794 // ap_bonus = (getRangedAttackPower()+(int32_t)getRangedAttackPowerMods())/14000.0;
16795 attackPowerBonus = getCalculatedRangedAttackPower() / 14000.0f;
16796 bonus = attackPowerBonus * item->getItemProperties()->Delay;
16797
16798 if (getAmmoId() && !m_requiresNoAmmo)
16799 {
16800 ItemProperties const* xproto = sMySQLStore.getItemProperties(getAmmoId());
16801 if (xproto)
16802 {
16803 bonus += ((xproto->Damage[0].Min + xproto->Damage[0].Max) * item->getItemProperties()->Delay) / 2000.0f;
16804 }
16805 }
16806 }
16807 else
16808#endif
16809 bonus = 0;
16810
16811 rangeDamage = m_baseRangedDamage[0] + deltaDone + bonus;
16812 rangeDamage *= damageMod;
16813 setMinRangedDamage(rangeDamage > 0 ? rangeDamage : 0);
16814
16815 rangeDamage = m_baseRangedDamage[1] + deltaDone + bonus;
16816 rangeDamage *= damageMod;
16817 setMaxRangedDamage(rangeDamage > 0 ? rangeDamage : 0);
16818
16819 if (m_wratings.size())
16820 {
16821 std::map<uint32_t, uint32_t>::iterator itr = m_wratings.find(item->getItemProperties()->SubClass);
16822 if (itr != m_wratings.end())
16823 cr = itr->second;
16824 }
16825
16826 }
16827 //\todo investigate
16828#if VERSION_STRING != Classic
16830#endif
16831 // Ranged END
16832 if (auto* const pet = getPet())
16833 pet->calculateDamage();//Re-calculate pet's too
16834}
@ CR_WEAPON_SKILL_RANGED
@ CR_WEAPON_SKILL_OFFHAND
@ CR_WEAPON_SKILL_MAINHAND
uint32_t getModDamageDonePositive(uint16_t school) const
Definition Player.cpp:1201
std::map< uint32_t, WeaponModifier > m_damageDone
Definition Player.hpp:2093
float m_offhandDmgMod
Definition Player.hpp:1937
std::map< uint32_t, uint32_t > m_wratings
Definition Player.hpp:1932
bool isInFeralForm()
Definition Player.cpp:4113
void setCombatRating(uint8_t combatRating, uint32_t value)
Definition Player.cpp:1277
bool m_requiresNoAmmo
Definition Player.hpp:2043
uint32_t getModDamageDoneNegative(uint16_t school) const
Definition Player.cpp:1205
void setMaxRangedDamage(float damage)
Definition Unit.cpp:1600
void setMaxOffhandDamage(float damage)
Definition Unit.cpp:1291
void setMinOffhandDamage(float damage)
Definition Unit.cpp:1288
bool m_isDisarmed
Definition Unit.hpp:1479
void setMinRangedDamage(float damage)
Definition Unit.cpp:1597
void setMinDamage(float damage)
Definition Unit.cpp:1282
int32_t getCalculatedAttackPower() const
Definition Unit.cpp:1813
void setMaxDamage(float damage)
Definition Unit.cpp:1285
int32_t getCalculatedRangedAttackPower() const
Definition Unit.cpp:1822
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateHealthRegenerationValue()

float_t Player::calculateHealthRegenerationValue ( bool  inCombat) const

Definition at line 201 of file PlayerStats.cpp.

202{
203 float_t regenerateValue = 0.0f;
204#if VERSION_STRING == Classic
205 const auto spirit = getStat(STAT_SPIRIT);
206 switch (getClass())
207 {
208 case DRUID:
209 case MAGE:
210 regenerateValue = spirit * 0.11f + 1.0f;
211 break;
212 case HUNTER:
213 regenerateValue = spirit * 0.43f - 5.5f;
214 break;
215 case PALADIN:
216 regenerateValue = spirit * 0.25f;
217 break;
218 case PRIEST:
219 regenerateValue = spirit * 0.15f + 1.4f;
220 break;
221 case ROGUE:
222 regenerateValue = spirit * 0.84f - 13.0f;
223 break;
224 case SHAMAN:
225 regenerateValue = spirit * 0.28f - 3.6f;
226 break;
227 case WARLOCK:
228 regenerateValue = spirit * 0.12f + 1.5f;
229 break;
230 case WARRIOR:
231 regenerateValue = spirit * 1.26f - 22.6f;
232 break;
233 default:
234 break;
235 }
236#elif VERSION_STRING == TBC || VERSION_STRING == WotLK
237 auto playerLevel = getLevel();
238 if (playerLevel > DBC_STAT_LEVEL_CAP)
239 playerLevel = DBC_STAT_LEVEL_CAP;
240
241 // Get base health regeneration value from DBC
242 const auto index = (getClass() - 1) * DBC_STAT_LEVEL_CAP + playerLevel - 1;
243
244 float_t baseRegen = 0.0f;
245 if (const auto hpPerSpiritDBC = sGtOCTRegenHPStore.lookupEntry(index))
246 baseRegen = hpPerSpiritDBC->ratio;
247
248 float_t extraRegen = 0.0f;
249 if (const auto hpPerSpiritDBC = sGtRegenHPPerSptStore.lookupEntry(index))
250 extraRegen = hpPerSpiritDBC->ratio;
251
252 auto spirit = getStat(STAT_SPIRIT);
253 uint32_t extraSpirit = 0;
254 if (spirit > 50)
255 {
256 extraSpirit = spirit - 50;
257 spirit = 50;
258 }
259
260 regenerateValue = spirit * baseRegen + extraSpirit * extraRegen;
261#elif VERSION_STRING >= Cata
262 const auto maxHp = static_cast<float_t>(getMaxHealth());
263 if (getLevel() < 15)
264 regenerateValue = 0.2f * (maxHp / getLevel());
265 else
266 regenerateValue = 0.015f * maxHp;
267#endif
268
269 // Food buffs
270 // The value is stored as per 5 seconds
272 // Percentage mods
274 // According to wowwiki health regeneration is increased by 33% while sitting
275 if (m_isResting || isSitting())
276 regenerateValue *= 1.33f;
277 // Apply config rate
278 regenerateValue *= worldConfig.getFloatRate(RATE_HEALTH);
279
280 // Combat modifier
281 if (inCombat)
283
284 // Auras like Demon Armor in pre wotlk work in combat as well
285 // The value is stored as per 5 seconds
287
288 return regenerateValue;
289}
@ SPELL_AURA_MOD_HEALTH_REGEN_ALWAYS
@ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
@ SPELL_AURA_MOD_HEALTH_REGEN
@ SPELL_AURA_MOD_HEALTH_REGEN_DURING_COMBAT
@ MAGE
@ HUNTER
@ ROGUE
@ PRIEST
@ PALADIN
@ WARRIOR
@ SHAMAN
#define DBC_STAT_LEVEL_CAP
@ RATE_HEALTH
Definition WorldConfig.h:14
float_t getTotalFloatDamageForAuraEffect(AuraEffect aura_effect) const
Definition Unit.cpp:4973
bool isSitting() const
Definition Unit.cpp:7054
float_t getTotalPctMultiplierForAuraEffect(AuraEffect aura_effect) const
Definition Unit.cpp:4994
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canBuyAt()

bool Player::canBuyAt ( MySQLStructure::VendorRestrictions const vendor)

Definition at line 10221 of file Player.cpp.

10222{
10223 if (vendor == nullptr)
10224 return true;
10225
10226 if (vendor->flags == RESTRICTION_CHECK_ALL)
10227 {
10228 if ((vendor->racemask > 0) && !(getRaceMask() & vendor->racemask))
10229 return false;
10230
10231 if ((vendor->classmask > 0) && !(getClassMask() & vendor->classmask))
10232 return false;
10233
10234 if (vendor->reqrepfaction)
10235 {
10236 uint32_t plrep = getFactionStanding(vendor->reqrepfaction);
10237 if (plrep < vendor->reqrepvalue)
10238 return false;
10239 }
10240 }
10241 else if (vendor->flags == RESTRICTION_CHECK_MOUNT_VENDOR)
10242 {
10243 if ((vendor->racemask > 0) && (vendor->reqrepfaction))
10244 {
10245 uint32_t plrep = getFactionStanding(vendor->reqrepfaction);
10246 if (!(getRaceMask() & vendor->racemask) && (plrep < vendor->reqrepvalue))
10247 return false;
10248 }
10249 else
10250 {
10251 sLogger.failure("VendorRestrictions: Mount vendor specified, but not enough m_playerCreateInfo for creature {}", vendor->entry);
10252 }
10253 }
10254
10255 return true;
10256}
@ RESTRICTION_CHECK_ALL
@ RESTRICTION_CHECK_MOUNT_VENDOR
this checks for all possible values in table
int32_t getFactionStanding(uint32_t faction)
Definition Player.cpp:11432
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelDuel()

void Player::cancelDuel ( )

Definition at line 12074 of file Player.cpp.

12075{
12076 WoWGuid wowGuid;
12077 wowGuid.Init(getDuelArbiter());
12078
12079 const auto goFlag = getWorldMap()->getGameObject(wowGuid.getGuidLowPart());
12080 if (goFlag)
12081 goFlag->RemoveFromWorld(true);
12082
12083 setDuelArbiter(0);
12085
12088
12090 setDuelTeam(0);
12091
12094
12095 m_duelPlayer->m_duelPlayer = nullptr;
12096 m_duelPlayer = nullptr;
12097}
@ DUEL_STATE_FINISHED
void RemoveFromWorld(bool free_guid)
Remove object from world.
uint64_t getDuelArbiter() const
Definition Player.cpp:765
void setDuelTeam(uint32_t team)
Definition Player.cpp:871
uint32_t m_duelCountdownTimer
Definition Player.hpp:1729
uint8_t m_duelState
Definition Player.hpp:1728
void setDuelArbiter(uint64_t guid)
Definition Player.cpp:766
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelTrade()

void Player::cancelTrade ( bool  sendToSelfAlso,
bool  silently = false 
)

Definition at line 6511 of file Player.cpp.

6512{
6513 // TODO: for some reason client sends multiple trade cancel packets which at some point leads to nullptr trade data
6514 // investigate why client sends so many packets but use mutex for now to prevent crashes -Appled
6515 std::scoped_lock<std::mutex> guard(m_tradeMutex);
6516
6517 if (m_TradeData != nullptr)
6518 {
6519 if (sendToSelfAlso)
6521
6522 if (auto* tradeTarget = m_TradeData->getTradeTarget())
6523 {
6524 std::scoped_lock<std::mutex> targetGuard(tradeTarget->m_tradeMutex);
6525 if (!silently)
6526 tradeTarget->getSession()->sendTradeResult(TRADE_STATUS_CANCELLED);
6527
6528 tradeTarget->m_TradeData = nullptr;
6529 }
6530
6531 m_TradeData = nullptr;
6532 }
6533}
@ TRADE_STATUS_CANCELLED
std::mutex m_tradeMutex
Definition Player.hpp:1052
void sendTradeResult(TradeStatus result, uint64_t guid=0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canDualWield2H()

bool Player::canDualWield2H ( ) const

Definition at line 4261 of file Player.cpp.

4262{
4263 return m_canDualWield2H;
4264}
bool m_canDualWield2H
Definition Player.hpp:972
Here is the caller graph for this function:

◆ canGainXp()

bool Player::canGainXp ( ) const

Definition at line 12204 of file Player.cpp.

12204{ return m_isXpGainAllowed; }
bool m_isXpGainAllowed
Definition Player.hpp:1747
Here is the caller graph for this function:

◆ canSignCharter()

bool Player::canSignCharter ( Charter const charter,
Player requester 
)

Definition at line 7838 of file Player.cpp.

7839{
7840 if (charter == nullptr || requester == nullptr)
7841 return false;
7842
7843 if (charter->getCharterType() >= CHARTER_TYPE_ARENA_2V2 && getArenaTeam(charter->getCharterType() - 1U) != nullptr)
7844 return false;
7845
7846 if (charter->getCharterType() == CHARTER_TYPE_GUILD && isInGuild())
7847 return false;
7848
7849 if (m_charters[charter->getCharterType()] || requester->getTeam() != getTeam() || this == requester)
7850 return false;
7851
7852 return true;
7853}
@ CHARTER_TYPE_GUILD
@ CHARTER_TYPE_ARENA_2V2
PlayerTeam getTeam() const
Definition Player.cpp:2774
std::array< Charter *, NUM_CHARTER_TYPES > m_charters
Definition Player.hpp:1273
ArenaTeam * getArenaTeam(uint8_t type)
Definition Player.cpp:8070
bool isInGuild()
Definition Player.cpp:7866
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canTrainAt()

bool Player::canTrainAt ( Trainer const trainer)

Definition at line 10258 of file Player.cpp.

10259{
10260 if (!trainer)
10261 return false;
10262
10263 if ((trainer->RequiredClass && this->getClass() != trainer->RequiredClass) ||
10264 ((trainer->RequiredRace && this->getRace() != trainer->RequiredRace) &&
10265 ((trainer->RequiredRepFaction && trainer->RequiredRepValue) &&
10266 this->getFactionStanding(trainer->RequiredRepFaction) != static_cast<int32_t>(trainer->RequiredRepValue))) ||
10267 (trainer->RequiredSkill && !this->hasSkillLine(trainer->RequiredSkill)) ||
10268 (trainer->RequiredSkillLine && this->getSkillLineCurrent(trainer->RequiredSkill) < trainer->RequiredSkillLine))
10269 {
10270 return false;
10271 }
10272
10273 return true;
10274}
Here is the caller graph for this function:

◆ canUseFlyingMountHere()

bool Player::canUseFlyingMountHere ( )

Definition at line 4210 of file Player.cpp.

4211{
4212#if VERSION_STRING == Classic
4213 return false;
4214#else
4215 auto areaEntry = GetArea();
4216 if (areaEntry == nullptr)
4217 // If area is null, try finding any area from the zone with zone id
4219 if (areaEntry == nullptr)
4220 return false;
4221
4222 // Not flyable areas (such as Dalaran in wotlk)
4224 return false;
4225
4226 // Get continent map id
4227 auto mapId = GetMapId();
4228 if (mapId == 530 || mapId == 571)
4229 {
4230 const auto worldMapEntry = sWorldMapAreaStore.lookupEntry(getZoneId());
4231 if (worldMapEntry != nullptr)
4232 mapId = worldMapEntry->continentMapId >= 0 ? worldMapEntry->continentMapId : worldMapEntry->mapId;
4233 }
4234
4235 switch (mapId)
4236 {
4237 // Eastern Kingdoms
4238 case 0:
4239 // Kalimdor
4240 case 1:
4241 // Flight Master's License
4242 if (!hasSpell(90267))
4243 return false;
4244 break;
4245 // Outland
4246 case 530:
4247 return true;
4248 // Northrend
4249 case 571:
4250 // Cold Weather Flying
4251 if (!hasSpell(54197))
4252 return false;
4253 break;
4254 default:
4255 return false;
4256 }
4257 return true;
4258#endif
4259}
SERVER_DECL WDB::WDBContainer< WDB::Structures::WorldMapAreaEntry > sWorldMapAreaStore
static WDB::Structures::AreaTableEntry const * GetAreaById(uint32_t area_id)
::WDB::Structures::AreaTableEntry const * GetArea() const
Definition Object.cpp:1766
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeLanguage()

void Player::changeLanguage ( uint64_t  guid,
uint8_t  race 
)
static

Definition at line 2902 of file Player.cpp.

2903{
2904 const auto getSpellIdForLanguage = [](uint16_t skillId) -> uint32_t
2905 {
2906 switch (skillId)
2907 {
2908 case SKILL_LANG_COMMON:
2909 return 668;
2910 case SKILL_LANG_ORCISH:
2911 return 669;
2912 case SKILL_LANG_TAURAHE:
2913 return 670;
2915 return 671;
2916 case SKILL_LANG_DWARVEN:
2917 return 672;
2919 return 813;
2921 return 814;
2923 return 815;
2924 case SKILL_LANG_TITAN:
2925 return 816;
2927 return 817;
2928 case SKILL_LANG_GNOMISH:
2929 return 7340;
2930 case SKILL_LANG_TROLL:
2931 return 7341;
2933 return 17737;
2934#if VERSION_STRING >= TBC
2935 case SKILL_LANG_DRAENEI:
2936 return 29932;
2937#endif
2938#if VERSION_STRING >= Cata
2939 case SKILL_LANG_GOBLIN:
2940 return 69269;
2941 case SKILL_LANG_GILNEAN:
2942 return 69270;
2943#endif
2944#if VERSION_STRING >= Mop
2946 return 108127;
2948 return 108130;
2950 return 108131;
2951#endif
2952 }
2953
2954 return 0;
2955 };
2956
2957#if VERSION_STRING < TBC
2958 CharacterDatabase.Execute("DELETE FROM `playerspells` WHERE GUID = '%u' AND SpellID IN ('%u', '%u', '%u', '%u', '%u','%u', '%u', '%u', '%u');", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH), getSpellIdForLanguage(SKILL_LANG_TAURAHE), getSpellIdForLanguage(SKILL_LANG_TROLL), getSpellIdForLanguage(SKILL_LANG_GUTTERSPEAK), getSpellIdForLanguage(SKILL_LANG_THALASSIAN), getSpellIdForLanguage(SKILL_LANG_COMMON), getSpellIdForLanguage(SKILL_LANG_DARNASSIAN), getSpellIdForLanguage(SKILL_LANG_DWARVEN), getSpellIdForLanguage(SKILL_LANG_GNOMISH));
2959#elif VERSION_STRING < Cata
2960 CharacterDatabase.Execute("DELETE FROM `playerspells` WHERE GUID = '%u' AND SpellID IN ('%u', '%u', '%u', '%u', '%u','%u', '%u', '%u', '%u', '%u');", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH), getSpellIdForLanguage(SKILL_LANG_TAURAHE), getSpellIdForLanguage(SKILL_LANG_TROLL), getSpellIdForLanguage(SKILL_LANG_GUTTERSPEAK), getSpellIdForLanguage(SKILL_LANG_THALASSIAN), getSpellIdForLanguage(SKILL_LANG_COMMON), getSpellIdForLanguage(SKILL_LANG_DARNASSIAN), getSpellIdForLanguage(SKILL_LANG_DRAENEI), getSpellIdForLanguage(SKILL_LANG_DWARVEN), getSpellIdForLanguage(SKILL_LANG_GNOMISH));
2961#elif VERSION_STRING == Cata
2962 CharacterDatabase.Execute("DELETE FROM `playerspells` WHERE GUID = '%u' AND SpellID IN ('%u', '%u', '%u', '%u', '%u','%u', '%u', '%u', '%u', '%u');", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH), getSpellIdForLanguage(SKILL_LANG_TAURAHE), getSpellIdForLanguage(SKILL_LANG_TROLL), getSpellIdForLanguage(SKILL_LANG_GUTTERSPEAK), getSpellIdForLanguage(SKILL_LANG_THALASSIAN), getSpellIdForLanguage(SKILL_LANG_COMMON), getSpellIdForLanguage(SKILL_LANG_DARNASSIAN), getSpellIdForLanguage(SKILL_LANG_DRAENEI), getSpellIdForLanguage(SKILL_LANG_DWARVEN), getSpellIdForLanguage(SKILL_LANG_GNOMISH), getSpellIdForLanguage(SKILL_LANG_GILNEAN), getSpellIdForLanguage(SKILL_LANG_GOBLIN));
2963#elif VERSION_STRING == Mop
2964 CharacterDatabase.Execute("DELETE FROM `playerspells` WHERE GUID = '%u' AND SpellID IN ('%u', '%u', '%u', '%u', '%u','%u', '%u', '%u', '%u', '%u');", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH), getSpellIdForLanguage(SKILL_LANG_TAURAHE), getSpellIdForLanguage(SKILL_LANG_TROLL), getSpellIdForLanguage(SKILL_LANG_GUTTERSPEAK), getSpellIdForLanguage(SKILL_LANG_THALASSIAN), getSpellIdForLanguage(SKILL_LANG_COMMON), getSpellIdForLanguage(SKILL_LANG_DARNASSIAN), getSpellIdForLanguage(SKILL_LANG_DRAENEI), getSpellIdForLanguage(SKILL_LANG_DWARVEN), getSpellIdForLanguage(SKILL_LANG_GNOMISH), getSpellIdForLanguage(SKILL_LANG_GILNEAN), getSpellIdForLanguage(SKILL_LANG_GOBLIN), getSpellIdForLanguage(SKILL_LANG_PANDAREN_NEUTRAL), getSpellIdForLanguage(SKILL_LANG_PANDAREN_ALLIANCE), getSpellIdForLanguage(SKILL_LANG_PANDAREN_HORDE));
2965#endif
2966 switch (race)
2967 {
2968 case RACE_DWARF:
2969 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_COMMON));
2970 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_DWARVEN));
2971 break;
2972#if VERSION_STRING > Classic
2973 case RACE_DRAENEI:
2974 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_COMMON));
2975 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_DRAENEI));
2976 break;
2977#endif
2978 case RACE_GNOME:
2979 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_COMMON));
2980 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_GNOMISH));
2981 break;
2982 case RACE_NIGHTELF:
2983 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_COMMON));
2984 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_DARNASSIAN));
2985 break;
2986 case RACE_UNDEAD:
2987 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH));
2988 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_GUTTERSPEAK));
2989 break;
2990 case RACE_TAUREN:
2991 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH));
2992 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_TAURAHE));
2993 break;
2994 case RACE_TROLL:
2995 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH));
2996 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_TROLL));
2997 break;
2998#if VERSION_STRING > Classic
2999 case RACE_BLOODELF:
3000 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH));
3001 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_THALASSIAN));
3002 break;
3003#endif
3004#if VERSION_STRING >= Cata
3005 case RACE_WORGEN:
3006 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_COMMON));
3007 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_GILNEAN));
3008 break;
3009 case RACE_GOBLIN:
3010 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH));
3011 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_GOBLIN));
3012 break;
3013#endif
3014#if VERSION_STRING >= Mop
3016 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_COMMON));
3017 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH));
3018 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_PANDAREN_NEUTRAL));
3019 break;
3021 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_COMMON));
3022 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_PANDAREN_ALLIANCE));
3023 break;
3025 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_ORCISH));
3026 CharacterDatabase.Execute("INSERT INTO `playerspells` (GUID, SpellID) VALUES ('%u', '%u')", static_cast<uint32_t>(guid), getSpellIdForLanguage(SKILL_LANG_PANDAREN_HORDE));
3027 break;
3028#endif
3029 }
3030}
@ RACE_TROLL
@ RACE_UNDEAD
@ RACE_PANDAREN_NEUTRAL
@ RACE_DRAENEI
@ RACE_BLOODELF
@ RACE_DWARF
@ RACE_GNOME
@ RACE_GOBLIN
@ RACE_WORGEN
@ RACE_PANDAREN_ALLIANCE
@ RACE_PANDAREN_HORDE
@ RACE_TAUREN
@ SKILL_LANG_GNOMISH
Definition Skill.hpp:121
@ SKILL_LANG_COMMON
Definition Skill.hpp:39
@ SKILL_LANG_PANDAREN_NEUTRAL
Definition Skill.hpp:243
@ SKILL_LANG_DRAENEI
Definition Skill.hpp:168
@ SKILL_LANG_ORCISH
Definition Skill.hpp:41
@ SKILL_LANG_TROLL
Definition Skill.hpp:122
@ SKILL_LANG_GUTTERSPEAK
Definition Skill.hpp:157
@ SKILL_LANG_OLD_TONGUE
Definition Skill.hpp:58
@ SKILL_LANG_TAURAHE
Definition Skill.hpp:44
@ SKILL_LANG_PANDAREN_ALLIANCE
Definition Skill.hpp:244
@ SKILL_LANG_TITAN
Definition Skill.hpp:57
@ SKILL_LANG_DARNASSIAN
Definition Skill.hpp:43
@ SKILL_LANG_DEMON_TONGUE
Definition Skill.hpp:56
@ SKILL_LANG_DWARVEN
Definition Skill.hpp:42
@ SKILL_LANG_THALASSIAN
Definition Skill.hpp:54
@ SKILL_LANG_GILNEAN
Definition Skill.hpp:207
@ SKILL_LANG_PANDAREN_HORDE
Definition Skill.hpp:245
@ SKILL_LANG_DRACONIC
Definition Skill.hpp:55
@ SKILL_LANG_GOBLIN
Definition Skill.hpp:208

◆ changeLooks()

void Player::changeLooks ( uint64_t  guid,
uint8_t  gender,
uint8_t  skin,
uint8_t  face,
uint8_t  hairStyle,
uint8_t  hairColor,
uint8_t  facialHair 
)
static

Definition at line 2887 of file Player.cpp.

2888{
2889 auto result = CharacterDatabase.Query("SELECT bytes2 FROM `characters` WHERE guid = '%u'", static_cast<uint32_t>(guid));
2890 if (!result)
2891 return;
2892
2893 Field* fields = result->Fetch();
2894
2895 uint32_t player_bytes2 = fields[0].asUint32();
2896 player_bytes2 &= ~0xFF;
2897 player_bytes2 |= facialHair;
2898
2899 CharacterDatabase.Execute("UPDATE `characters` SET gender = '%u', bytes = '%u', bytes2 = '%u' WHERE guid = '%u'", gender, skin | (face << 8) | (hairStyle << 16) | (hairColor << 24), player_bytes2, (uint32_t)guid);
2900}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkDamageLimits()

uint32_t Player::checkDamageLimits ( uint32_t  damage,
uint32_t  spellId 
)

Definition at line 13289 of file Player.cpp.

13290{
13291 std::stringstream dmglog;
13292
13293 if ((spellId != 0) && (worldConfig.limit.maxSpellDamageCap > 0))
13294 {
13295 if (damage > worldConfig.limit.maxSpellDamageCap)
13296 {
13297 dmglog << "Dealt " << damage << " with spell " << spellId;
13298
13299 sCheatLog.writefromsession(m_session, dmglog.str().c_str());
13300
13301 if (worldConfig.limit.disconnectPlayerForExceedingLimits != 0)
13303
13304 damage = worldConfig.limit.maxSpellDamageCap;
13305 }
13306 }
13307 else if ((worldConfig.limit.maxAutoAttackDamageCap > 0) && (damage > worldConfig.limit.maxAutoAttackDamageCap))
13308 {
13309 dmglog << "Dealt " << damage << " with auto attack";
13310 sCheatLog.writefromsession(m_session, dmglog.str().c_str());
13311
13312 if (worldConfig.limit.disconnectPlayerForExceedingLimits != 0)
13314
13315 damage = worldConfig.limit.maxAutoAttackDamageCap;
13316 }
13317
13318 if (worldConfig.limit.broadcastMessageToGmOnExceeding != 0)
13319 sendReportToGmMessage(getName(), dmglog.str());
13320
13321 return damage;
13322}
#define sCheatLog
void sendReportToGmMessage(std::string playerName, std::string damageLog)
Definition Player.cpp:6537
utf8_string getName() const
Definition Player.cpp:2639
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkInstanceCount()

bool Player::checkInstanceCount ( uint32_t  instanceId) const

Definition at line 13119 of file Player.cpp.

13120{
13121 //\todo: Max Instances Per Hour is per Default 5 add these to Configs
13122 if (m_instanceResetTimes.size() < 5)
13123 return true;
13124
13125 return m_instanceResetTimes.find(instanceId) != m_instanceResetTimes.end();
13126}
Here is the caller graph for this function:

◆ cleanupAfterTaxiFlight()

void Player::cleanupAfterTaxiFlight ( )

Definition at line 10693 of file Player.cpp.

10694{
10695 m_taxi->clearTaxiDestinations(); // not destinations, clear source node
10696 dismount();
10698}
@ UNIT_FLAG_MOUNTED_TAXI
void removeUnitFlags(uint32_t unitFlags)
Definition Unit.cpp:1110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearComboPoints()

void Player::clearComboPoints ( )

Definition at line 5420 of file Player.cpp.

5421{
5422 m_comboTarget = 0;
5423 m_comboPoints = 0;
5424
5425 // Remove combo point retain auras when combo points have been used
5427
5429}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCooldownForSpell()

void Player::clearCooldownForSpell ( uint32_t  spellId)

Definition at line 4422 of file Player.cpp.

4423{
4424 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
4425 if (spellInfo == nullptr)
4426 return;
4427
4428 // Send cooldown clear packet
4429 getSession()->SendPacket(SmsgClearCooldown(spellId, getGuid()).serialise().get());
4430
4431 for (uint8_t i = 0; i < NUM_COOLDOWN_TYPES; ++i)
4432 {
4433 for (auto itr = m_cooldownMap[i].begin(); itr != m_cooldownMap[i].end();)
4434 {
4435 auto cooldown = (*itr);
4436 if ((i == COOLDOWN_TYPE_CATEGORY && cooldown.first == spellInfo->getCategory()) ||
4437 (i == COOLDOWN_TYPE_SPELL && cooldown.first == spellInfo->getId()))
4438 {
4439 itr = m_cooldownMap[i].erase(itr);
4440 }
4441 else
4442 {
4443 ++itr;
4444 }
4445 }
4446 }
4447}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCooldownsOnLine()

void Player::clearCooldownsOnLine ( uint32_t  skillLine,
uint32_t  calledFrom 
)

Definition at line 16141 of file Player.cpp.

16142{
16143 for (const auto& spellId : m_spellSet)
16144 {
16145 if (spellId == calledFrom)
16146 continue;
16147
16148 const auto spellSkillRange = sSpellMgr.getSkillEntryRangeForSpell(spellId);
16149 for (const auto& [_, skill_line_ability] : spellSkillRange)
16150 {
16151 if (skill_line_ability->skilline == skillLine)
16152 clearCooldownForSpell(spellId);
16153 }
16154 }
16155}
void clearCooldownForSpell(uint32_t spellId)
Definition Player.cpp:4422
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearGlobalCooldown()

void Player::clearGlobalCooldown ( )

Definition at line 4449 of file Player.cpp.

4450{
4452}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearInRangeSets()

void Player::clearInRangeSets ( )
overridevirtual

Reimplemented from Object.

Definition at line 15808 of file Player.cpp.

15809{
15810 m_visibleObjects.clear();
15812}
void clearInRangeSets()
Definition Unit.cpp:7585
Here is the call graph for this function:

◆ clearQuest()

void Player::clearQuest ( uint32_t  questId)

Definition at line 8945 of file Player.cpp.

8946{
8947 m_finishedQuests.erase(questId);
8948 m_finishedDailies.erase(questId);
8949}
Here is the caller graph for this function:

◆ completeLoading()

void Player::completeLoading ( )

Definition at line 16200 of file Player.cpp.

16201{
16203
16204 SpellCastTargets targets(getGuid());
16205
16206 if (getClass() == WARRIOR)
16207 castSpell(this, sSpellMgr.getSpellInfo(2457), true);
16208
16209 for (const auto& spellId : m_spellSet)
16210 {
16211 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
16212
16213 if (spellInfo != nullptr
16214 && (spellInfo->isPassive())
16215 && !(spellInfo->custom_c_is_flags & SPELL_FLAG_IS_EXPIREING_WITH_PET))
16216 {
16217 if (spellInfo->getRequiredShapeShift())
16218 {
16219 if (!(getShapeShiftMask() & spellInfo->getRequiredShapeShift()))
16220 continue;
16221 }
16222
16223 if (spellInfo->getCasterAuraState() != 0 && !hasAuraState(static_cast<AuraState>(spellInfo->getCasterAuraState()), spellInfo, this))
16224 continue;
16225
16226 Spell* newSpell = sSpellMgr.newSpell(this, spellInfo, true, nullptr);
16227 newSpell->prepare(&targets);
16228 }
16229 }
16230
16231 for (auto& loginaura : m_loginAuras)
16232 {
16233 if (SpellInfo const* sp = sSpellMgr.getSpellInfo(loginaura.id))
16234 {
16235 if (sp->custom_c_is_flags & SPELL_FLAG_IS_EXPIREING_WITH_PET)
16236 continue; //do not load auras that only exist while pet exist. We should recast these when pet is created anyway
16237
16238 auto aura = sSpellMgr.newAura(sp, loginaura.dur, this, this, false);
16239 for (uint8_t x = 0; x < 3; x++)
16240 {
16241 if (sp->getEffect(x) == SPELL_EFFECT_APPLY_AURA)
16242 {
16243 aura->addAuraEffect(static_cast<AuraEffect>(sp->getEffectApplyAuraName(x)), sp->getEffectBasePoints(x) + 1, sp->getEffectMiscValue(x), 1.0f, false, x);
16244 }
16245 }
16246
16247 if (sp->getProcCharges() > 0 && loginaura.charges > 0)
16248 aura->setCharges(static_cast<uint16_t>(loginaura.charges), false);
16249
16250 this->addAura(std::move(aura));
16251 }
16252 }
16253
16255 {
16257 }
16259 {
16260 if (const auto corpse = sObjectMgr.getCorpseByOwner(getGuidLow()))
16262 else
16264 }
16265
16266 if (isDead())
16267 {
16268 if (getCorpseInstanceId() != 0)
16269 {
16270 if (const auto corpse = sObjectMgr.getCorpseByOwner(getGuidLow()))
16271 corpse->resetDeathClock();
16272
16274 }
16275 }
16276
16277#if VERSION_STRING > TBC
16278 // useless logon spell
16279 Spell* logonspell = sSpellMgr.newSpell(this, sSpellMgr.getSpellInfo(836), false, nullptr);
16280 logonspell->prepare(&targets);
16281#endif
16282
16283 if (isBanned())
16284 {
16285 kickFromServer(10000);
16288 }
16289
16290 if (m_playerInfo->m_Group)
16291 {
16293 }
16294
16296 {
16297 sendRaidGroupOnly(0xFFFFFFFF, 0);
16298 m_sendOnlyRaidgroup = false;
16299 }
16300
16301#if VERSION_STRING > TBC
16302 // add glyphs
16303 for (uint8_t j = 0; j < GLYPHS_COUNT; ++j)
16304 {
16305 auto glyph_properties = sGlyphPropertiesStore.lookupEntry(m_specs[m_talentActiveSpec].getGlyph(j));
16306 if (glyph_properties == nullptr)
16307 continue;
16308
16309 castSpell(this, glyph_properties->SpellID, true);
16310 }
16311
16312 //sEventMgr.AddEvent(this,&Player::SendAllAchievementData,EVENT_SEND_ACHIEVEMNTS_TO_PLAYER,ACHIEVEMENT_SEND_DELAY,1,0);
16314#endif
16315}
AuraEffect
AuraState
Definition AuraStates.hpp:9
#define CORPSE_RECLAIM_TIME_MS
@ EVENT_PLAYER_CHECKFORCHEATS
Definition EventMgr.h:44
@ EVENT_SEND_PACKET_TO_PLAYER_AFTER_LOGIN
Definition EventMgr.h:87
@ EVENT_UNK
Definition EventMgr.h:30
#define LOGIN_CIENT_SEND_DELAY
@ SPELL_EFFECT_APPLY_AURA
@ CORPSE
@ SS_BANNED_FOR_TIME
@ SS_NOT_ALLOWED_TO_PLAY
const float & GetPositionZ() const
Definition Object.hpp:356
void repopAtGraveyard(float ox, float oy, float oz, uint32_t mapId)
Definition Player.cpp:7622
int32_t getCorpseInstanceId() const
Definition Player.cpp:7430
bool m_sendOnlyRaidgroup
Definition Player.hpp:1320
std::string getBanReason() const
Definition Player.cpp:2342
void kickFromServer(uint32_t delay=0)
Definition Player.cpp:2354
bool hasPlayerFlags(uint32_t flags) const
Definition Player.cpp:786
void eventGroupFullUpdate()
Definition Player.cpp:7947
void sendRaidGroupOnly(uint32_t timeInMs, uint32_t type)
Definition Player.cpp:9890
std::list< LoginAura > m_loginAuras
Definition Player.hpp:1964
void setGuildAndGroupInfo()
Definition Player.cpp:9517
bool isBanned() const
Definition Player.cpp:2330
void broadcastMessage(const char *Format,...)
Definition Player.cpp:6552
bool hasAuraState(AuraState state, SpellInfo const *spellInfo=nullptr, Unit const *caster=nullptr) const
Definition Unit.cpp:5130
virtual void setDeathState(DeathState state)
Definition Unit.cpp:7875
uint32_t getHealth() const
Definition Unit.cpp:481
void addAura(std::unique_ptr< Aura > aur)
Definition Unit.cpp:4538
G3D::int16 x
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compressAndSendUpdateBuffer()

bool Player::compressAndSendUpdateBuffer ( uint32_t  size,
const uint8_t update_buffer 
)

Definition at line 3242 of file Player.cpp.

3243{
3244 uint32_t destsize = size + size / 10 + 16;
3245 int rate = worldConfig.getIntRate(INTRATE_COMPRESSION);
3246 if (size >= 40000 && rate < 6)
3247 rate = 6;
3248
3249 // set up stream
3250 z_stream stream;
3251 stream.zalloc = nullptr;
3252 stream.zfree = nullptr;
3253 stream.opaque = nullptr;
3254
3255 if (deflateInit(&stream, rate) != Z_OK)
3256 {
3257 sLogger.failure("deflateInit failed.");
3258 return false;
3259 }
3260
3261 auto buffer = std::make_unique<uint8_t[]>(destsize);
3262
3263 // set up stream pointers
3264 stream.next_out = (Bytef*)buffer.get() + 4;
3265 stream.avail_out = destsize;
3266 stream.next_in = (Bytef*)update_buffer;
3267 stream.avail_in = size;
3268
3269 // call the actual process
3270 if (deflate(&stream, Z_NO_FLUSH) != Z_OK ||
3271 stream.avail_in != 0)
3272 {
3273 sLogger.failure("deflate failed.");
3274 return false;
3275 }
3276
3277 // finish the deflate
3278 if (deflate(&stream, Z_FINISH) != Z_STREAM_END)
3279 {
3280 sLogger.failure("deflate failed: did not end stream");
3281 return false;
3282 }
3283
3284 // finish up
3285 if (deflateEnd(&stream) != Z_OK)
3286 {
3287 sLogger.failure("deflateEnd failed.");
3288 return false;
3289 }
3290
3291 // fill in the full size of the compressed stream
3292 *(uint32_t*)&buffer[0] = size;
3293
3294#if VERSION_STRING < Cata
3295 m_session->OutPacket(SMSG_COMPRESSED_UPDATE_OBJECT, static_cast<uint16_t>(stream.total_out) + 4, buffer.get());
3296#else
3297 m_session->OutPacket(SMSG_UPDATE_OBJECT, static_cast<uint16_t>(stream.total_out) + 4, buffer.get());
3298#endif
3299
3300 return true;
3301}
@ SMSG_COMPRESSED_UPDATE_OBJECT
Definition Opcodes.hpp:557
@ SMSG_UPDATE_OBJECT
Definition Opcodes.hpp:206
int ZEXPORT deflateEnd(z_streamp strm)
Definition deflate.c:895
int ZEXPORT deflate(z_streamp strm, int flush)
Definition deflate.c:582
Byte FAR Bytef
Definition zconf.h:342
#define Z_STREAM_END
Definition zlib.h:174
#define Z_FINISH
Definition zlib.h:168
#define Z_OK
Definition zlib.h:173
#define Z_NO_FLUSH
Definition zlib.h:164
#define deflateInit(strm, level)
Definition zlib.h:1546
@ INTRATE_COMPRESSION
Definition WorldConfig.h:49
void OutPacket(uint16_t opcode)
static uint32_t * buffer
uInt avail_in
Definition zlib.h:87
Bytef * next_in
Definition zlib.h:86
alloc_func zalloc
Definition zlib.h:97
uInt avail_out
Definition zlib.h:91
Bytef * next_out
Definition zlib.h:90
free_func zfree
Definition zlib.h:98
voidpf opaque
Definition zlib.h:99
uLong total_out
Definition zlib.h:92
Here is the call graph for this function:
Here is the caller graph for this function:

◆ continueTaxiFlight()

void Player::continueTaxiFlight ( ) const

Definition at line 10700 of file Player.cpp.

10701{
10702 uint32_t sourceNode = m_taxi->getTaxiSource();
10703 if (!sourceNode)
10704 return;
10705
10706 uint32_t mountDisplayId = sTaxiMgr.getTaxiMountDisplayId(sourceNode, getTeam(), true);
10707 if (!mountDisplayId)
10708 return;
10709
10710 uint32_t path = m_taxi->getCurrentTaxiPath();
10711
10712 // search appropriate start path node
10713 uint32_t startNode = m_taxi->nodeAfterTeleport;
10714
10715 TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
10716
10717 float distPrev;
10718 float distNext = getExactDistSq(nodeList[0]->x, nodeList[0]->y, nodeList[0]->z);
10719
10720 for (uint32_t i = 1; i < nodeList.size(); ++i)
10721 {
10722 WDB::Structures::TaxiPathNodeEntry const* node = nodeList[i];
10723 WDB::Structures::TaxiPathNodeEntry const* prevNode = nodeList[i - 1];
10724
10725 // skip nodes at another map
10726 if (node->mapid != GetMapId())
10727 continue;
10728
10729 distPrev = distNext;
10730
10731 distNext = getExactDistSq(node->x, node->y, node->z);
10732
10733 float distNodes =
10734 (node->x - prevNode->x) * (node->x - prevNode->x) +
10735 (node->y - prevNode->y) * (node->y - prevNode->y) +
10736 (node->z - prevNode->z) * (node->z - prevNode->z);
10737
10738 if (distNext + distPrev < distNodes)
10739 {
10740 startNode = i;
10741 break;
10742 }
10743 }
10744
10745 getSession()->sendDoFlight(mountDisplayId, path, startNode);
10746}
TaxiPathNodesByPath sTaxiPathNodesByPath
std::vector< WDB::Structures::TaxiPathNodeEntry const * > TaxiPathNodeList
float getExactDistSq(float x, float y, float z) const
Definition Object.hpp:415
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cooldownAddItem()

void Player::cooldownAddItem ( ItemProperties const itemProp,
uint32_t  spellIndex 
)

Definition at line 4478 of file Player.cpp.

4479{
4480 if (itemProp->Spells[spellIndex].CategoryCooldown <= 0 && itemProp->Spells[spellIndex].Cooldown <= 0)
4481 return;
4482
4484 return;
4485
4486 ItemSpell const* itemSpell = &itemProp->Spells[spellIndex];
4487 uint32_t mstime = Util::getMSTime();
4488
4489 uint32_t itemSpellId = itemSpell->Id;
4490
4491 uint32_t categoryId = itemSpell->Category;
4492 int32_t categoryCooldownTime = itemSpell->CategoryCooldown;
4493
4494 if (itemSpell->CategoryCooldown > 0)
4495 _addCategoryCooldown(categoryId, categoryCooldownTime + mstime, itemSpellId, itemProp->ItemId);
4496
4497 int32_t cooldownTime = itemSpell->Cooldown;
4498 if (cooldownTime > 0)
4499 _addCooldown(COOLDOWN_TYPE_SPELL, itemSpellId, cooldownTime + mstime, itemSpellId, itemProp->ItemId);
4500}
PlayerCheat m_cheats
Definition Player.hpp:1090
int32_t CategoryCooldown
int32_t Cooldown
uint32_t Category
uint32_t Id
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cooldownCanCast()

bool Player::cooldownCanCast ( ItemProperties const itemProp,
uint32_t  spellIndex 
)

Definition at line 4502 of file Player.cpp.

4503{
4504 PlayerCooldownMap::iterator cooldownMapItr;
4505 ItemSpell const* itemSpell = &itemProp->Spells[spellIndex];
4506 uint32_t mstime = Util::getMSTime();
4507
4508 if (itemSpell->Category)
4509 {
4510 cooldownMapItr = m_cooldownMap[COOLDOWN_TYPE_CATEGORY].find(itemSpell->Category);
4511 if (cooldownMapItr != m_cooldownMap[COOLDOWN_TYPE_CATEGORY].end())
4512 {
4513 if (mstime < cooldownMapItr->second.ExpireTime)
4514 return false;
4515
4516 m_cooldownMap[COOLDOWN_TYPE_CATEGORY].erase(cooldownMapItr);
4517 }
4518 }
4519
4520 cooldownMapItr = m_cooldownMap[COOLDOWN_TYPE_SPELL].find(itemSpell->Id);
4521 if (cooldownMapItr != m_cooldownMap[COOLDOWN_TYPE_SPELL].end())
4522 {
4523 if (mstime < cooldownMapItr->second.ExpireTime)
4524 return false;
4525
4526 m_cooldownMap[COOLDOWN_TYPE_SPELL].erase(cooldownMapItr);
4527 }
4528
4529 return true;
4530}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyAndSendDelayedPacket()

void Player::copyAndSendDelayedPacket ( WorldPacket data)

Definition at line 3550 of file Player.cpp.

3550{ m_updateMgr.queueDelayedPacket(std::make_unique<WorldPacket>(*data)); }
void queueDelayedPacket(std::unique_ptr< WorldPacket > packet)
Here is the call graph for this function:

◆ create()

bool Player::create ( CharCreate charCreateContent)

Definition at line 2422 of file Player.cpp.

2423{
2424 m_name = charCreateContent.name;
2426
2427 //\todo: Zyres: we already have a method to check if the race/class combination is valid (somewhere in the char list generation).
2428 m_playerCreateInfo = sMySQLStore.getPlayerCreateInfo(charCreateContent._race, charCreateContent._class);
2429 if (m_playerCreateInfo == nullptr)
2430 {
2432#if VERSION_STRING > TBC
2433 if (charCreateContent._class == DEATHKNIGHT)
2434 sLogger.failure("Account Name: {} tried to create a deathknight, however your playercreateinfo table does not support this class, please update your database.", m_session->GetAccountName());
2435 else
2436#endif
2437 sLogger.failure("Account Name: {} tried to create an invalid character with race {} and class {}, if this is intended please update your playercreateinfo table inside your database.", m_session->GetAccountName(), charCreateContent._race, charCreateContent._class);
2438 return false;
2439 }
2440
2441 // check that the account creates only new ones with available races, if we're making some
2442#if VERSION_STRING > Classic
2443 if (charCreateContent._race >= RACE_BLOODELF && !(m_session->_accountFlags & ACCOUNT_FLAG_XPACK_01))
2444#else
2445 if (charCreateContent._race >= RACE_TROLL)
2446#endif
2447 {
2449 return false;
2450 }
2451
2452#if VERSION_STRING > TBC
2453 // check that the account can create deathknights, if we're making one
2454 if (charCreateContent._class == DEATHKNIGHT && !(m_session->_accountFlags & ACCOUNT_FLAG_XPACK_02))
2455 {
2456 sLogger.failure("Account {} tried to create a DeathKnight, but Account flag is {}!", m_session->GetAccountName(), m_session->_accountFlags);
2458 return false;
2459 }
2460#endif
2461
2465
2467 m_isResting = 0;
2468 m_restAmount = 0;
2469 m_restState = 0;
2470
2471 // set race dbc
2472 m_dbcRace = sChrRacesStore.lookupEntry(charCreateContent._race);
2473 m_dbcClass = sChrClassesStore.lookupEntry(charCreateContent._class);
2474 if (!m_dbcRace || !m_dbcClass)
2475 {
2476 // information not found
2477 sCheatLog.writefromsession(m_session, "tried to create invalid player with race %u and class %u, dbc m_playerCreateInfo not found", charCreateContent._race, charCreateContent._class);
2479 return false;
2480 }
2481
2482 if (m_dbcRace->team_id == 7)
2483 m_team = 0;
2484 else
2485 m_team = 1;
2486
2487 // Automatically add the race's taxi hub to the character's taximask at creation time (1 << (taxi_node_id-1))
2488 // this is defined in table playercreateinfo, field taximask
2489 //memcpy(m_taxiMask, m_playerCreateInfo->taximask, sizeof(m_taxiMask));
2490
2491 if (auto playerClassLevelStats = sMySQLStore.getPlayerClassLevelStats(1, charCreateContent._class))
2492 setMaxHealth(playerClassLevelStats->health);
2493 else
2494 sLogger.failure("No class levelstats found!");
2495
2496 if (const auto raceEntry = sChrRacesStore.lookupEntry(charCreateContent._race))
2497 setFaction(raceEntry->faction_id);
2498 else
2499 setFaction(0);
2500
2501#if VERSION_STRING > TBC
2502 if (charCreateContent._class != DEATHKNIGHT || worldConfig.player.playerStartingLevel > 55)
2503#endif
2504 {
2505 setLevel(worldConfig.player.playerStartingLevel);
2506 }
2507#if VERSION_STRING > TBC
2508 else
2509 {
2510 setLevel(55);
2511 }
2512#endif
2513
2514 setRace(charCreateContent._race);
2515 setClass(charCreateContent._class);
2516 setGender(charCreateContent.gender);
2517
2519 setInitialDisplayIds(charCreateContent.gender, charCreateContent._race);
2520
2522
2523 // PLAYER_BYTES
2524 setSkinColor(charCreateContent.skin);
2525 setFace(charCreateContent.face);
2526 setHairStyle(charCreateContent.hairStyle);
2527 setHairColor(charCreateContent.hairColor);
2528
2529 // PLAYER_BYTES_2
2530 setPlayerBytes2(0);
2531 setFacialFeatures(charCreateContent.facialHair);
2533
2534 // PLAYER_BYTES_3
2535 setPlayerBytes3(0);
2536 setPlayerGender(charCreateContent.gender);
2537
2539
2540 // Gold Starting Amount
2541 setCoinage(worldConfig.player.startGoldAmount);
2542
2543 // Default value is -1
2544 setWatchedFaction(std::numeric_limits<uint32_t>::max());
2545
2546 // Profession points
2547 setFreePrimaryProfessionPoints(worldConfig.player.maxProfessions);
2548
2550
2551 m_firstLogin = true;
2552
2553 // add dbc items
2554 if (const auto charStartOutfitEntry = getStartOutfitByRaceClass(charCreateContent._race, charCreateContent._class, charCreateContent.gender))
2555 {
2556 for (uint8_t j = 0; j < OUTFIT_ITEMS; ++j)
2557 {
2558 if (charStartOutfitEntry->ItemId[j] <= 0)
2559 continue;
2560
2561 const uint32_t itemId = charStartOutfitEntry->ItemId[j];
2562
2563 const auto itemProperties = sMySQLStore.getItemProperties(itemId);
2564 if (!itemProperties)
2565 {
2566 sLogger.debug("StartOutfit - Item with entry {} not in item_properties table but in CharStartOutfit.dbc!", itemId);
2567 continue;
2568 }
2569
2570 auto item = sObjectMgr.createItem(itemId, this);
2571 if (item)
2572 {
2573 item->setStackCount(1);
2574
2575 int8_t itemSlot = 0;
2576
2577 //shitty db lets check for dbc/db2 values
2578 if (itemProperties->InventoryType == 0)
2579 {
2580 if (const auto itemDB2Properties = sItemStore.lookupEntry(itemId))
2581 itemSlot = getItemInterface()->GetItemSlotByType(itemDB2Properties->InventoryType);
2582 }
2583 else
2584 {
2585 itemSlot = getItemInterface()->GetItemSlotByType(itemProperties->InventoryType);
2586 }
2587
2588 //use safeadd only for equipmentset items... all other items will go to a free bag slot.
2589 if (itemSlot < INVENTORY_SLOT_BAG_END && (itemProperties->Class == ITEM_CLASS_ARMOR || itemProperties->Class == ITEM_CLASS_WEAPON || itemProperties->Class == ITEM_CLASS_CONTAINER || itemProperties->Class == ITEM_CLASS_QUIVER))
2590 {
2591 const auto [addResult, _] = getItemInterface()->SafeAddItem(std::move(item), INVENTORY_SLOT_NOT_SET, itemSlot);
2592 if (!addResult)
2593 {
2594 sLogger.debug("StartOutfit - Item with entry {} can not be added safe to slot {}!", itemId, static_cast<uint32_t>(itemSlot));
2595 }
2596 }
2597 else
2598 {
2599 item->setStackCount(itemProperties->MaxCount);
2600 const auto [addResult, _] = getItemInterface()->AddItemToFreeSlot(std::move(item));
2601 if (!addResult)
2602 {
2603 sLogger.debug("StartOutfit - Item with entry {} can not be added to a free slot!", itemId);
2604 }
2605 }
2606 }
2607 }
2608 }
2609
2610 for (std::list<CreateInfo_ItemStruct>::const_iterator is = m_playerCreateInfo->items.begin(); is != m_playerCreateInfo->items.end(); ++is)
2611 {
2612 if ((*is).id != 0)
2613 {
2614 auto item = sObjectMgr.createItem((*is).id, this);
2615 if (item)
2616 {
2617 item->setStackCount((*is).amount);
2618 if ((*is).slot < INVENTORY_SLOT_BAG_END)
2619 {
2620 getItemInterface()->SafeAddItem(std::move(item), INVENTORY_SLOT_NOT_SET, (*is).slot);
2621 }
2622 else
2623 {
2624 getItemInterface()->AddItemToFreeSlot(std::move(item));
2625 }
2626 }
2627 }
2628 }
2629
2630 sHookInterface.OnCharacterCreate(this);
2633 return true;
2634}
@ ITEM_CLASS_QUIVER
@ ITEM_CLASS_CONTAINER
#define INVENTORY_SLOT_NOT_SET
@ ACCOUNT_FLAG_XPACK_01
@ ACCOUNT_FLAG_XPACK_02
@ RESTSTATE_NORMAL
@ PLAYER_MISC_FLAG_SHOW_RELEASE_TIME
SERVER_DECL WDB::WDBContainer< WDB::Structures::ChrRacesEntry > sChrRacesStore
Definition WDBStores.cpp:66
SERVER_DECL WDB::WDBContainer< WDB::Structures::ItemEntry > sItemStore
SERVER_DECL WDB::WDBContainer< WDB::Structures::ChrClassesEntry > sChrClassesStore
Definition WDBStores.cpp:65
WDB::Structures::CharStartOutfitEntry const * getStartOutfitByRaceClass(uint8_t race, uint8_t class_, uint8_t gender)
#define OUTFIT_ITEMS
Item * SafeAddItem(uint32_t ItemId, int8_t ContainerSlot, int16_t slot)
Creates and adds a item that can be manipulated after.
int8_t GetItemSlotByType(uint32_t type)
void setStackCount(uint32_t count)
Definition Item.cpp:144
void setZoneId(uint32_t newZone)
Definition Object.cpp:4396
void setHairColor(uint8_t color)
Definition Player.cpp:834
uint32_t m_loadHealth
Definition Player.hpp:730
void setFace(uint8_t face)
Definition Player.cpp:828
void setRestState(uint8_t state)
Definition Player.cpp:848
uint32_t m_team
Definition Player.hpp:739
void setInitialDisplayIds(uint8_t gender, uint8_t race)
Definition Player.cpp:2645
void setPlayerGender(uint8_t gender)
Definition Player.cpp:856
void initialiseNoseLevel()
Definition Player.cpp:1636
void setFreePrimaryProfessionPoints(uint32_t points)
Definition Player.cpp:1052
PlayerCreateInfo const * m_playerCreateInfo
Definition Player.hpp:750
void setHairStyle(uint8_t style)
Definition Player.cpp:831
WDB::Structures::ChrClassesEntry const * m_dbcClass
Definition Player.hpp:728
void setPlayerBytes2(uint32_t bytes2)
Definition Player.cpp:839
void setCoinage(uint64_t coinage)
Definition Player.cpp:1185
WDB::Structures::ChrRacesEntry const * m_dbcRace
Definition Player.hpp:727
void setSkinColor(uint8_t color)
Definition Player.cpp:825
void addPlayerFieldBytesMiscFlag(uint8_t miscFlag)
Definition Player.cpp:1231
utf8_string m_name
Definition Player.hpp:735
void setWatchedFaction(uint32_t factionId)
Definition Player.cpp:1139
void setPlayerBytes3(uint32_t bytes3)
Definition Player.cpp:853
uint32_t m_loadMana
Definition Player.hpp:731
uint8_t m_stableSlotCount
Definition Player.hpp:1808
void setBindPoint(float x, float y, float z, float o, uint32_t mapId, uint32_t zoneId)
Definition Player.cpp:7809
void setFacialFeatures(uint8_t feature)
Definition Player.cpp:842
void eventModelChange()
Definition Unit.cpp:9091
void setClass(uint8_t class_)
Definition Unit.cpp:457
void setMaxHealth(uint32_t maxHealth)
Definition Unit.cpp:626
void setGender(uint8_t gender)
Definition Unit.cpp:460
void setFaction(uint32_t factionId)
Definition Unit.hpp:261
void setRace(uint8_t race)
Definition Unit.cpp:454
std::string GetAccountName()
uint32_t _accountFlags
void capitalize(std::string &str)
Capitalize word (uppercase first char, lowercase rest)
Definition Strings.cpp:28
utf8_string name
std::list< CreateInfo_ItemStruct > items
signed char int8_t
Here is the call graph for this function:

◆ createCorpse()

void Player::createCorpse ( )

Definition at line 7445 of file Player.cpp.

7446{
7447 sObjectMgr.delinkCorpseForPlayer(this);
7448
7450 {
7452 return;
7453 }
7454
7455 const auto corpse = sObjectMgr.createCorpse();
7456 corpse->SetInstanceID(GetInstanceID());
7457 corpse->create(this, GetMapId(), GetPosition());
7458
7459 corpse->setZoneId(getZoneId());
7460
7461 corpse->setRace(getRace());
7462 corpse->setSkinColor(getSkinColor());
7463
7464 corpse->setFace(getFace());
7465 corpse->setHairStyle(getHairStyle());
7466 corpse->setHairColor(getHairColor());
7467 corpse->setFacialFeatures(getFacialFeatures());
7468
7469 corpse->setFlags(CORPSE_FLAG_UNK1);
7470
7471 corpse->setDisplayId(getDisplayId());
7472
7473 if (m_bg)
7474 {
7477
7478 loot.gold = 0;
7479
7480 corpse->generateLoot();
7482 corpse->setDynamicFlags(1);
7483 else
7485
7486 m_lootableOnCorpse = false;
7487 }
7488 else
7489 {
7490 corpse->loot.gold = 0;
7491 }
7492
7493 for (uint8_t slot = 0; slot < EQUIPMENT_SLOT_END; ++slot)
7494 {
7495 if (Item* item = getItemInterface()->GetInventoryItem(slot))
7496 {
7497 const uint32_t displayId = item->getItemProperties()->DisplayInfoID;
7498 const auto inventoryType = static_cast<uint16_t>(item->getItemProperties()->InventoryType);
7499
7500 const uint32_t itemId = static_cast<uint16_t>(displayId) | inventoryType << 24;
7501 corpse->setItem(slot, itemId);
7502 }
7503 }
7504
7505 corpse->saveToDB();
7506}
@ CORPSE_FLAG_UNK1
Definition Corpse.hpp:24
@ CORPSE_FLAG_LOOT
Definition Corpse.hpp:27
@ CORPSE_FLAG_HIDDEN_CLOAK
Definition Corpse.hpp:26
@ CORPSE_FLAG_HIDDEN_HELM
Definition Corpse.hpp:25
@ UNIT_FLAG_SKINNABLE
@ U_DYN_FLAG_LOOTABLE
void removeDynamicFlags(uint16_t dynamicFlags)
Definition Object.cpp:396
int32_t GetInstanceID()
Definition Object.hpp:664
uint8_t getHairColor() const
Definition Player.cpp:833
Battleground * m_bg
Definition Player.hpp:1455
void setAllowedToCreateCorpse(bool allowed)
Definition Player.cpp:7435
bool m_lootableOnCorpse
Definition Player.hpp:1650
uint8_t getHairStyle() const
Definition Player.cpp:830
uint8_t getFacialFeatures() const
Definition Player.cpp:841
uint8_t getFace() const
Definition Player.cpp:827
bool isAllowedToCreateCorpse() const
Definition Player.cpp:7440
uint8_t getSkinColor() const
Definition Player.cpp:824
uint32_t getDisplayId() const
Definition Unit.cpp:1252
Loot loot
Definition Unit.hpp:1221
uint32_t gold
Definition Loot.hpp:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createQuestLogInSlot()

QuestLogEntry * Player::createQuestLogInSlot ( QuestProperties const questProperties,
uint8_t  slotId 
)

Definition at line 8818 of file Player.cpp.

8819{
8820 if (slotId >= MAX_QUEST_LOG_SIZE)
8821 return nullptr;
8822
8823 if (questProperties == nullptr)
8824 {
8825 m_questlog[slotId] = nullptr;
8826 return nullptr;
8827 }
8828
8829 m_questlog[slotId] = std::make_unique<QuestLogEntry>(questProperties, this, slotId);
8830 return m_questlog[slotId].get();
8831}
#define MAX_QUEST_LOG_SIZE
Here is the caller graph for this function:

◆ decrementHonorless()

void Player::decrementHonorless ( )

Definition at line 8194 of file Player.cpp.

8194{ m_honorless > 0 ? m_honorless-- : m_honorless = 0; }
uint32_t m_honorless
Definition Player.hpp:1390
Here is the caller graph for this function:

◆ die()

void Player::die ( Unit unitAttacker,
uint32_t  damage,
uint32_t  spellId 
)
overridevirtual

Reimplemented from Unit.

Definition at line 7258 of file Player.cpp.

7259{
7260 if (getDeathState() != ALIVE)
7261 return;
7262
7263#ifdef FT_VEHICLES
7264 callExitVehicle();
7265#endif
7266
7267#if VERSION_STRING > TBC
7268 if (unitAttacker != nullptr)
7269 {
7270 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1, 0, 0);
7271 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, GetMapId(), 1, 0);
7272
7273 if (unitAttacker->isPlayer())
7274 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, 0, 0);
7275 else if (unitAttacker->isCreature())
7276 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, 1, 0, 0);
7277 }
7278#endif
7279
7280 if (unitAttacker != nullptr && !sHookInterface.OnPreUnitDie(unitAttacker, this))
7281 return;
7282
7283 if (unitAttacker != nullptr && !unitAttacker->isPlayer())
7285
7287 eventDeath();
7288
7289 if (getChannelObjectGuid() != 0)
7290 {
7291 if (const auto spell = getCurrentSpell(CURRENT_CHANNELED_SPELL))
7292 {
7293 for (uint8_t i = 0; i < 3; i++)
7294 {
7295 if (spell->getSpellInfo()->getEffect(i) == SPELL_EFFECT_PERSISTENT_AREA_AURA)
7296 {
7297 const uint64_t guid = getChannelObjectGuid();
7299 if (!dynamicObject)
7300 continue;
7301
7302 dynamicObject->remove();
7303 }
7304 }
7305
7306 if (spell->getSpellInfo()->getChannelInterruptFlags() == 48140)
7307 interruptSpell(spell->getSpellInfo()->getId());
7308 }
7309 }
7310
7311 for (const auto& inRangePlayer : getInRangePlayersSet())
7312 {
7313 Unit* attacker = dynamic_cast<Unit*>(inRangePlayer);
7314 if (attacker && attacker->isCastingSpell())
7315 {
7316 for (uint8_t i = 0; i < CURRENT_SPELL_MAX; ++i)
7317 {
7318 if (attacker->getCurrentSpell(static_cast<CurrentSpellType>(i)) == nullptr)
7319 continue;
7320
7321 if (attacker->getCurrentSpell(static_cast<CurrentSpellType>(i))->m_targets.getUnitTargetGuid() == getGuid())
7322 attacker->interruptSpellWithSpellType(static_cast<CurrentSpellType>(i));
7323 }
7324 }
7325 }
7326
7327 smsg_AttackStop(unitAttacker);
7329
7331 setDynamicFlags(0);
7332
7333 m_session->SendPacket(SmsgCancelCombat().serialise().get());
7334
7336 data << GetNewGUID();
7337 sendMessageToSet(&data, false);
7338
7339 if (unitAttacker != nullptr && m_WorldMap && m_WorldMap->getScript())
7340 m_WorldMap->getScript()->OnPlayerDeath(this, unitAttacker);
7341
7342 uint32_t selfResSpellId = 0;
7343 if (!m_bg || m_bg && !m_bg->isArena())
7344 {
7345 selfResSpellId = getSelfResurrectSpell();
7346
7347 if (selfResSpellId == 0 && m_reincarnation)
7348 {
7349 SpellInfo const* m_reincarnSpellInfo = sSpellMgr.getSpellInfo(20608);
7350 if (!hasSpellOnCooldown(m_reincarnSpellInfo))
7351 {
7352 uint32_t ankhCount = getItemInterface()->GetItemCount(17030);
7353 if (ankhCount)
7354 selfResSpellId = 21169;
7355 }
7356 }
7357 }
7358
7359 setSelfResurrectSpell(selfResSpellId);
7361
7362 if (unitAttacker != nullptr)
7363 {
7364 if (unitAttacker->IsInWorld() && unitAttacker->isCreature() && static_cast<Creature*>(unitAttacker)->GetScript())
7365 static_cast<Creature*>(unitAttacker)->GetScript()->OnTargetDied(this);
7366
7367 unitAttacker->getAIInterface()->eventOnTargetDied(this);
7368 unitAttacker->smsg_AttackStop(this);
7369 }
7370
7372
7373 m_underwaterTime = 0;
7375
7376 setMoveRoot(true);
7380
7382
7383 // On player death set all pets offline
7384 // If player was i.e. mounted with pet inactive when they died its possible to get pet stuck in weird state
7386
7387 setHealth(0);
7388
7389 //check for spirit of Redemption
7390 if (hasSpell(20711))
7391 {
7392 SpellInfo const* sorInfo = sSpellMgr.getSpellInfo(27827);
7393 if (sorInfo != nullptr)
7394 {
7395 Spell* sor = sSpellMgr.newSpell(this, sorInfo, true, nullptr);
7396 SpellCastTargets targets(getGuid());
7397 sor->prepare(&targets);
7398 }
7399 }
7400
7402
7403 if (getClass() == WARRIOR)
7405#if VERSION_STRING == WotLK
7406 else if (getClass() == DEATHKNIGHT)
7408#endif
7409
7410 if (m_bg)
7411 {
7412 m_bg->HookOnUnitDied(this);
7413 m_bg->HookOnPlayerDeath(this);
7414 }
7415
7416 sHookInterface.OnDeath(this);
7417}
CurrentSpellType
Definition Object.hpp:65
@ CURRENT_SPELL_MAX
Definition Object.hpp:70
@ SMSG_CANCEL_AUTO_REPEAT
Definition Opcodes.hpp:731
@ POWER_TYPE_RUNIC_POWER
Definition PowerType.hpp:24
@ POWER_TYPE_RAGE
Definition PowerType.hpp:14
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ UNIT_FLAG_PVP_ATTACKABLE
@ ALIVE
@ JUST_DIED
void eventOnTargetDied(Object *pKiller)
we have to tell our current enemies to stop attacking us, we should also forget about our targets
virtual void HookOnPlayerDeath(Player *plr)=0
virtual void HookOnUnitDied(Unit *victim)
virtual void OnPlayerDeath(Player *, Unit *)
uint32_t GetItemCount(uint32_t itemid, bool IncBank=false)
Finds item ammount on inventory, banks not included.
void setDynamicFlags(uint16_t dynamicFlags)
Definition Object.cpp:394
std::vector< Object * > getInRangePlayersSet() const
Definition Object.cpp:1617
void interruptSpellWithSpellType(CurrentSpellType spellType)
Definition Object.cpp:713
const WoWGuid & GetNewGUID() const
Definition Object.hpp:335
void eventDeath()
Definition Player.cpp:13784
void sendMessageToSet(WorldPacket *data, bool sendToSelf, bool sendToOwnTeam=false) override
Definition Player.cpp:3192
bool m_reincarnation
Definition Player.hpp:2091
uint32_t m_underwaterTime
Definition Player.hpp:583
void calcDeathDurabilityLoss(double percent)
Definition Player.cpp:7747
uint32_t m_underwaterState
Definition Player.hpp:585
bool hasSpellOnCooldown(SpellInfo const *spellInfo)
Definition Player.cpp:4298
uint32_t getSelfResurrectSpell() const
Definition Player.cpp:1135
void setSelfResurrectSpell(uint32_t spell)
Definition Player.cpp:1136
uint64_t getUnitTargetGuid() const
SpellCastTargets m_targets
Definition Spell.hpp:535
void addUnitFlags(uint32_t unitFlags)
Definition Unit.cpp:1109
void setMountDisplayId(uint32_t id)
Definition Unit.cpp:1279
void smsg_AttackStop(Unit *pVictim)
Definition Unit.cpp:7533
SummonHandler * getSummonInterface()
Definition Unit.cpp:7943
DeathState getDeathState() const
Definition Unit.cpp:7924
AIInterface * getAIInterface() const
Definition Unit.hpp:705
uint64_t getChannelObjectGuid() const
Definition Unit.cpp:403
void clearHealthBatch()
Definition Unit.cpp:7488
CombatHandler & getCombatHandler()
Definition Unit.cpp:1803
static uint32_t getGuidLowPartFromUInt64(uint64_t guid)
Definition WoWGuid.h:228
InstanceScript * getScript()
DynamicObject * getDynamicObject(uint32_t guid)
Here is the caller graph for this function:

◆ disableAppearing()

void Player::disableAppearing ( bool  disable)

Definition at line 2327 of file Player.cpp.

2327{ m_disableAppearing = disable; }
bool m_disableAppearing
Definition Player.hpp:1101
Here is the caller graph for this function:

◆ disableSummoning()

void Player::disableSummoning ( bool  disable)

Definition at line 2325 of file Player.cpp.

2325{ m_disableSummoning = disable; }
bool m_disableSummoning
Definition Player.hpp:1102
Here is the caller graph for this function:

◆ displayCreatureSetForEntry()

void Player::displayCreatureSetForEntry ( uint32_t  _creatureEntry)

Definition at line 13282 of file Player.cpp.

13283{
13284 if (InstanceMap* instance = sMapMgr.findInstanceMap(GetInstanceID()))
13285 if (instance->getScript())
13286 instance->getScript()->getCreatureSetForEntry(_creatureEntry, true, this);
13287}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ displayDataStateList()

void Player::displayDataStateList ( )

Definition at line 13269 of file Player.cpp.

13270{
13271 if (InstanceMap* instance = sMapMgr.findInstanceMap(GetInstanceID()))
13272 if (instance->getScript())
13273 instance->getScript()->displayDataStateList(this);
13274}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ displayTimerList()

void Player::displayTimerList ( )

Definition at line 13276 of file Player.cpp.

13277{
13278 if (InstanceMap* instance = sMapMgr.findInstanceMap(GetInstanceID()))
13279 if (instance->getScript())
13280 instance->getScript()->displayTimerList(this);
13281}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ejectFromInstance()

void Player::ejectFromInstance ( )

Definition at line 2301 of file Player.cpp.

2302{
2303 if (getBGEntryPosition().isSet() && !IS_INSTANCE(getBGEntryMapId()))
2305 return;
2306
2308}
#define IS_INSTANCE(a)
uint32_t getBindMapId() const
Definition Player.cpp:7817
LocationVector getBindPosition() const
Definition Player.cpp:7816
bool safeTeleport(uint32_t mapId, uint32_t instanceId, const LocationVector &vec)
Definition Player.cpp:1772
LocationVector getBGEntryPosition() const
Definition Player.cpp:7829
int32_t getBGEntryInstanceId() const
Definition Player.cpp:7831
uint32_t getBGEntryMapId() const
Definition Player.cpp:7830
Here is the call graph for this function:
Here is the caller graph for this function:

◆ endDuel()

void Player::endDuel ( uint8_t  condition)

Definition at line 11955 of file Player.cpp.

11956{
11957 WoWGuid wowGuid;
11958 wowGuid.Init(getDuelArbiter());
11959
11961 {
11962 if (wowGuid.getGuidLowPart())
11963 {
11964 GameObject* arbiter = m_WorldMap ? getWorldMap()->getGameObject(wowGuid.getGuidLowPart()) : nullptr;
11965 if (arbiter)
11966 {
11967 arbiter->RemoveFromWorld(true);
11968 delete arbiter;
11969 }
11970
11972 setDuelArbiter(0);
11973
11975 setDuelTeam(0);
11976
11979
11980 m_duelPlayer->m_duelPlayer = nullptr;
11981 m_duelPlayer = nullptr;
11982 }
11983
11984 return;
11985 }
11986
11987 sEventMgr.RemoveEvents(this, EVENT_PLAYER_DUEL_COUNTDOWN);
11988 sEventMgr.RemoveEvents(this, EVENT_PLAYER_DUEL_BOUNDARY_CHECK);
11989
11991 {
11992 auto* const aur = getAuraWithAuraSlot(x);
11993 if (aur == nullptr)
11994 continue;
11995
11996 if (aur->WasCastInDuel())
11997 aur->removeAura();
11998 }
11999
12001
12002 if (m_duelPlayer == nullptr)
12003 return;
12004
12007
12009 {
12010 auto* const aur = m_duelPlayer->getAuraWithAuraSlot(x);
12011 if (aur == nullptr)
12012 continue;
12013 if (aur->WasCastInDuel())
12014 aur->removeAura();
12015 }
12016
12018
12019 sendMessageToSet(SmsgDuelWinner(condition, getName(), m_duelPlayer->getName()).serialise().get(), true);
12020 sendMessageToSet(SmsgDuelComplete(1).serialise().get(), true);
12021
12022 if (condition != 0)
12023 sHookInterface.OnDuelFinished(m_duelPlayer, this);
12024 else
12025 sHookInterface.OnDuelFinished(this, m_duelPlayer);
12026
12027 GameObject* goFlag = m_WorldMap ? getWorldMap()->getGameObject(wowGuid.getGuidLowPart()) : nullptr;
12028 if (goFlag)
12029 {
12030 goFlag->RemoveFromWorld(true);
12031 delete goFlag;
12032 }
12033
12034 setDuelArbiter(0);
12036
12037 setDuelTeam(0);
12039
12042
12043 for (auto& summon : getSummonInterface()->getSummons())
12044 {
12045 summon->getCombatHandler().clearCombat();
12046 summon->getAIInterface()->setPetOwner(this);
12047 summon->getAIInterface()->handleEvent(EVENT_FOLLOWOWNER, summon, 0);
12048 summon->getThreatManager().clearAllThreat();
12049 summon->getThreatManager().removeMeFromThreatLists();
12050 }
12051
12052 for (auto& duelingWithSummon : m_duelPlayer->getSummonInterface()->getSummons())
12053 {
12054 duelingWithSummon->getCombatHandler().clearCombat();
12055 duelingWithSummon->getAIInterface()->setPetOwner(this);
12056 duelingWithSummon->getAIInterface()->handleEvent(EVENT_FOLLOWOWNER, duelingWithSummon, 0);
12057 duelingWithSummon->getThreatManager().clearAllThreat();
12058 duelingWithSummon->getThreatManager().removeMeFromThreatLists();
12059 }
12060
12061 m_session->SendPacket(SmsgCancelCombat().serialise().get());
12062 m_duelPlayer->m_session->SendPacket(SmsgCancelCombat().serialise().get());
12063
12066
12069
12070 m_duelPlayer->m_duelPlayer = nullptr;
12071 m_duelPlayer = nullptr;
12072}
@ EVENT_FOLLOWOWNER
Definition AIEvents.h:22
@ EVENT_PLAYER_DUEL_COUNTDOWN
Definition EventMgr.h:57
@ EVENT_PLAYER_DUEL_BOUNDARY_CHECK
Definition EventMgr.h:58
void removeAura(AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
@ NEGATIVE_SLOT_START
Definition AuraSlots.hpp:24
@ NEGATIVE_SLOT_END
Definition AuraSlots.hpp:25
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventAttackStart()

void Player::eventAttackStart ( )

Definition at line 13770 of file Player.cpp.

13771{
13772 m_attacking = true;
13773 dismount();
13774}
bool m_attacking
Definition Player.hpp:2209
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventAttackStop()

void Player::eventAttackStop ( )

Definition at line 13776 of file Player.cpp.

13777{
13778 if (getCharmGuid() != 0)
13779 sEventMgr.RemoveEvents(this, EVENT_PLAYER_CHARM_ATTACK);
13780
13781 m_attacking = false;
13782}
@ EVENT_PLAYER_CHARM_ATTACK
Definition EventMgr.h:52
uint64_t getCharmGuid() const
Definition Unit.cpp:380
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventCannibalize()

void Player::eventCannibalize ( uint32_t  amount)

Definition at line 15814 of file Player.cpp.

15815{
15816 if (getChannelSpellId() != 20577)
15817 {
15818 sEventMgr.RemoveEvents(this, EVENT_CANNIBALIZE);
15819 m_cannibalize = false;
15821 return;
15822 }
15823
15824 uint32_t amt = (getMaxHealth() * amount) / 100;
15825
15826 uint32_t newHealth = getHealth() + amt;
15827 if (newHealth <= getMaxHealth())
15828 setHealth(newHealth);
15829 else
15831
15833 if (m_cannibalizeCount == 5)
15835
15836 sendPeriodicAuraLog(GetNewGUID(), GetNewGUID(), sSpellMgr.getSpellInfo(20577), amt, 0, 0, 0, SPELL_AURA_PERIODIC_HEAL_PCT, false);
15837}
@ SPELL_AURA_PERIODIC_HEAL_PCT
uint8_t m_cannibalizeCount
Definition Player.hpp:2096
uint32_t getChannelSpellId() const
Definition Unit.cpp:406
bool sendPeriodicAuraLog(const WoWGuid &casterGuid, const WoWGuid &targetGuid, SpellInfo const *spellInfo, uint32_t amount, uint32_t overKillOrOverHeal, uint32_t absorbed, uint32_t resisted, AuraEffect auraEffect, bool isCritical, uint32_t miscValue=0, float gainMultiplier=0.0f)
Definition Unit.cpp:5716
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventCharmAttack()

void Player::eventCharmAttack ( )

Definition at line 13699 of file Player.cpp.

13700{
13701 if (!getCharmGuid())
13702 return;
13703
13704 if (!IsInWorld())
13705 {
13706 setCharmGuid(0);
13707 sEventMgr.RemoveEvents(this, EVENT_PLAYER_CHARM_ATTACK);
13708 return;
13709 }
13710
13711 if (getTargetGuid() == 0)
13712 {
13713 sEventMgr.RemoveEvents(this, EVENT_PLAYER_CHARM_ATTACK);
13714 return;
13715 }
13716
13717 Unit* pVictim = getWorldMap()->getUnit(getTargetGuid());
13718 if (!pVictim)
13719 {
13720 sLogger.failure("WORLD: {} doesn't exist.", std::to_string(getTargetGuid()));
13721 sLogger.info("Player::Update: No valid current selection to attack, stopping attack");
13722 this->interruptHealthRegeneration(5000); //prevent clicking off creature for a quick heal
13723 // todo
13724 //removeUnitStateFlag(UNIT_STATE_ATTACKING);
13726 }
13727 else
13728 {
13729 Unit* currentCharm = getWorldMap()->getUnit(getCharmGuid());
13730 if (!currentCharm)
13731 return;
13732
13733 if (!currentCharm->canReachWithAttack(pVictim))
13734 {
13735 if (m_AttackMsgTimer == 0)
13736 m_AttackMsgTimer = 2000;
13737
13738 sEventMgr.ModifyEventTimeLeft(this, EVENT_PLAYER_CHARM_ATTACK, 100);
13739 }
13740 else if (!currentCharm->isInFront(pVictim))
13741 {
13742 if (m_AttackMsgTimer == 0)
13743 {
13744#if VERSION_STRING < Mop
13745 sendPacket(SmsgAttackSwingBadFacing().serialise().get());
13746#endif
13747 m_AttackMsgTimer = 2000; // 2 sec till next msg.
13748 }
13749
13750 sEventMgr.ModifyEventTimeLeft(this, EVENT_PLAYER_CHARM_ATTACK, 100);
13751 }
13752 else
13753 {
13754 if (!currentCharm->getOnMeleeSpell())
13755 {
13756 currentCharm->strike(pVictim, MELEE, nullptr, 0, 0, 0, false, false);
13757 }
13758 else
13759 {
13760 const auto spellInfo = sSpellMgr.getSpellInfo(currentCharm->getOnMeleeSpell());
13761 currentCharm->setOnMeleeSpell(0);
13762 Spell* spell = sSpellMgr.newSpell(currentCharm, spellInfo, true, nullptr);
13764 spell->prepare(&targets);
13765 }
13766 }
13767 }
13768}
void setOnMeleeSpell(uint32_t spellId, uint8_t ecn=0)
Definition Unit.hpp:1333
void setCharmGuid(uint64_t guid)
Definition Unit.cpp:381
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventDeath()

void Player::eventDeath ( )

Definition at line 13784 of file Player.cpp.

13785{
13786 if (!IS_INSTANCE(GetMapId()) && !sEventMgr.HasEvent(this, EVENT_PLAYER_FORCED_RESURRECT)) //Should never be true
13787 sEventMgr.AddEvent(this, &Player::repopRequest, EVENT_PLAYER_FORCED_RESURRECT, forcedResurrectInterval, 1, 0); //in case he forgets to release spirit (afk or something)
13788
13790
13792}
@ EVENT_PLAYER_FORCED_RESURRECT
Zack 2007 05 28: similar to pet expire but we can have multiple guardians.
Definition EventMgr.h:64
const time_t forcedResurrectInterval
void repopRequest()
Definition Player.cpp:7545
void setServersideDrunkValue(uint16_t newDrunkValue, uint32_t itemId=0)
Definition Player.cpp:11829
void removeAllNegativeAuras()
Definition Unit.cpp:5433
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventDismissPet()

void Player::eventDismissPet ( )

Definition at line 12697 of file Player.cpp.

12698{
12699 for (const auto& aura : getAuraList())
12700 if (aura && aura->getSpellInfo()->custom_c_is_flags & SPELL_FLAG_IS_EXPIREING_WITH_PET)
12701 aura->removeAura();
12702}
Here is the call graph for this function:

◆ eventExploration()

void Player::eventExploration ( )

Definition at line 2200 of file Player.cpp.

2201{
2202 if (isDead())
2203 return;
2204
2205 if (!IsInWorld())
2206 return;
2207
2209 return;
2210
2211 if (getWorldMap()->getCellByCoords(GetPositionX(), GetPositionY()) == nullptr)
2212 return;
2213
2214 if (auto areaTableEntry = this->GetArea())
2215 {
2216 uint16_t offset = static_cast<uint16_t>(areaTableEntry->explore_flag / 32);
2217 uint32_t val = (uint32_t)(1 << (areaTableEntry->explore_flag % 32));
2218 uint32_t currFields = getExploredZone(offset);
2219
2220 if (areaTableEntry->id != m_areaId)
2221 {
2222 m_areaId = areaTableEntry->id;
2223
2224 updatePvPArea();
2226
2227 if (getGroup())
2228 getGroup()->UpdateOutOfRangePlayer(this, true, nullptr);
2229 }
2230
2231 if (areaTableEntry->zone == 0 && m_zoneId != areaTableEntry->id)
2232 zoneUpdate(areaTableEntry->id);
2233 else if (areaTableEntry->zone != 0 && m_zoneId != areaTableEntry->zone)
2234 zoneUpdate(areaTableEntry->zone);
2235
2236
2237 if (areaTableEntry->zone != 0 && m_zoneId != areaTableEntry->zone)
2238 zoneUpdate(areaTableEntry->zone);
2239
2240 bool rest_on = false;
2241
2242 if (areaTableEntry->flags & AREA_CITY_AREA || areaTableEntry->flags & AREA_CITY)
2243 {
2244 // check faction
2245 if (areaTableEntry->team == AREAC_ALLIANCE_TERRITORY && isTeamAlliance() || (areaTableEntry->team == AREAC_HORDE_TERRITORY && isTeamHorde()))
2246 rest_on = true;
2247 else if (areaTableEntry->team != AREAC_ALLIANCE_TERRITORY && areaTableEntry->team != AREAC_HORDE_TERRITORY)
2248 rest_on = true;
2249 }
2250 else
2251 {
2252 //second AT check for subzones.
2253 if (areaTableEntry->zone)
2254 {
2255 auto at2 = AreaStorage::GetAreaById(areaTableEntry->zone);
2256 if (at2 && (at2->flags & AREA_CITY_AREA || at2->flags & AREA_CITY))
2257 {
2258 if (at2->team == AREAC_ALLIANCE_TERRITORY && isTeamAlliance() || (at2->team == AREAC_HORDE_TERRITORY && isTeamHorde()))
2259 rest_on = true;
2260 else if (at2->team != AREAC_ALLIANCE_TERRITORY && at2->team != AREAC_HORDE_TERRITORY)
2261 rest_on = true;
2262 }
2263 }
2264 }
2265
2266 if (rest_on)
2267 {
2268 if (!m_isResting)
2270 }
2271 else
2272 {
2273 if (m_isResting)
2274 applyPlayerRestState(false);
2275 }
2276
2277 if (!(currFields & val) && !m_taxi->getCurrentTaxiPath() && !obj_movement_info.transport_guid)
2278 {
2279 setExploredZone(offset, currFields | val);
2280
2281 uint32_t explore_xp = areaTableEntry->area_level * 10;
2282 explore_xp *= Util::float2int32(worldConfig.getFloatRate(RATE_EXPLOREXP));
2283
2284#if VERSION_STRING > TBC
2285 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA, getAreaId());
2286#endif
2287
2288 if (getLevel() < getMaxLevel() && explore_xp > 0)
2289 {
2290 sendExploreExperiencePacket(areaTableEntry->id, explore_xp);
2291 giveXp(explore_xp, 0, false);
2292 }
2293 else
2294 {
2295 sendExploreExperiencePacket(areaTableEntry->id, 0);
2296 }
2297 }
2298 }
2299}
@ GROUP_UPDATE_FULL
Definition Group.h:75
@ RATE_EXPLOREXP
Definition WorldConfig.h:33
void UpdateOutOfRangePlayer(Player *pPlayer, bool Distribute, WorldPacket *Packet)
Definition Group.cpp:837
MovementInfo obj_movement_info
Definition Object.hpp:632
uint32_t m_zoneId
Definition Object.hpp:731
uint32_t m_areaId
Definition Object.hpp:732
void zoneUpdate(uint32_t zoneId)
Definition Player.cpp:2097
void updatePvPArea()
Definition Player.cpp:8231
uint32_t getExploredZone(uint32_t idx) const
Definition Player.cpp:1122
bool isTeamHorde() const
Definition Player.cpp:2787
void addGroupUpdateFlag(uint32_t flag)
Definition Player.cpp:7908
void applyPlayerRestState(bool apply)
Definition Player.cpp:12245
void setExploredZone(uint32_t idx, uint32_t data)
Definition Player.cpp:1129
bool isTeamAlliance() const
Definition Player.cpp:2788
void sendExploreExperiencePacket(uint32_t areaId, uint32_t experience)
Definition Player.cpp:9671
uint32_t getMaxLevel() const
Definition Player.cpp:1149
void giveXp(uint32_t xp, const uint64_t &guid, bool allowBonus)
Definition Player.cpp:12133
ObjectGuid transport_guid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventGroupFullUpdate()

void Player::eventGroupFullUpdate ( )

Definition at line 7947 of file Player.cpp.

7948{
7949 if (m_playerInfo->m_Group)
7951}
void UpdateAllOutOfRangePlayersFor(Player *pPlayer)
Definition Group.cpp:1033
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventKickFromServer()

void Player::eventKickFromServer ( )

Definition at line 2368 of file Player.cpp.

2369{
2370 if (m_kickDelay)
2371 {
2372 if (m_kickDelay < 1500)
2373 m_kickDelay = 0;
2374 else
2375 m_kickDelay -= 1000;
2376
2377 getSession()->systemMessage("You will be removed from the server in {} seconds.", m_kickDelay / 1000);
2378 }
2379 else
2380 {
2381 sEventMgr.RemoveEvents(this, EVENT_PLAYER_KICK);
2382 getSession()->LogoutPlayer(true);
2383 }
2384}
@ EVENT_PLAYER_KICK
Definition EventMgr.h:53
uint32_t m_kickDelay
Definition Player.hpp:1108
void LogoutPlayer(bool Save)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventPortToGm()

void Player::eventPortToGm ( Player gmPlayer)

Definition at line 2018 of file Player.cpp.

2019{
2020 safeTeleport(gmPlayer->GetMapId(), gmPlayer->GetInstanceID(), gmPlayer->GetPosition());
2021}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventSummonPet()

void Player::eventSummonPet ( Pet summonPet)

Definition at line 12665 of file Player.cpp.

12666{
12667 if (summonPet)
12668 {
12669 for (const auto& spellId : m_spellSet)
12670 {
12671 if (const auto spellInfo = sSpellMgr.getSpellInfo(spellId))
12672 {
12673 if (spellInfo->custom_c_is_flags & SPELL_FLAG_IS_CASTED_ON_PET_SUMMON_PET_OWNER)
12674 {
12675 this->removeAllAurasByIdForGuid(spellId, this->getGuid());
12676 SpellCastTargets targets(this->getGuid());
12677 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr);
12678 spell->prepare(&targets);
12679 }
12680
12681 if (spellInfo->custom_c_is_flags & SPELL_FLAG_IS_CASTED_ON_PET_SUMMON_ON_PET)
12682 {
12683 this->removeAllAurasByIdForGuid(spellId, this->getGuid());
12684 SpellCastTargets targets(summonPet->getGuid());
12685 Spell* spell = sSpellMgr.newSpell(this, spellInfo, true, nullptr);
12686 spell->prepare(&targets);
12687 }
12688 }
12689 }
12690
12691 for (const auto& aura : getAuraList())
12692 if (aura && aura->getSpellInfo()->custom_c_is_flags & SPELL_FLAG_IS_EXPIREING_ON_PET)
12693 aura->removeAura();
12694 }
12695}
@ SPELL_FLAG_IS_EXPIREING_ON_PET
@ SPELL_FLAG_IS_CASTED_ON_PET_SUMMON_PET_OWNER
@ SPELL_FLAG_IS_CASTED_ON_PET_SUMMON_ON_PET
Here is the call graph for this function:

◆ eventTalentHearthOfWildChange()

void Player::eventTalentHearthOfWildChange ( bool  apply)

Definition at line 13583 of file Player.cpp.

13584{
13585 if (!m_hearthOfWildPct)
13586 return;
13587
13588 int tval;
13589 if (apply)
13590 tval = m_hearthOfWildPct;
13591 else
13592 tval = -m_hearthOfWildPct;
13593
13594 uint32_t shapeShiftForm = getShapeShiftForm();
13595
13596 if (shapeShiftForm == FORM_BEAR || shapeShiftForm == FORM_DIREBEAR)
13597 {
13600 updateStats();
13601
13602#if VERSION_STRING >= TBC
13603 updateChances();
13604#endif
13605 }
13606 else if (shapeShiftForm == FORM_CAT)
13607 {
13610 updateStats();
13611 }
13612}
void updateChances()
Definition Player.cpp:15401
int m_hearthOfWildPct
Definition Player.hpp:1962
float getAttackPowerMultiplier() const
Definition Unit.cpp:1654
float getRangedAttackPowerMultiplier() const
Definition Unit.cpp:1693
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventTeleport()

void Player::eventTeleport ( uint32_t  mapId,
LocationVector  position,
uint32_t  instanceId = 0 
)

Definition at line 1767 of file Player.cpp.

1768{
1769 safeTeleport(mapId, instanceId, position);
1770}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventTimedQuestExpire()

void Player::eventTimedQuestExpire ( uint32_t  questId)

Definition at line 8907 of file Player.cpp.

8908{
8909 if (QuestLogEntry* questLogEntry = this->getQuestLogByQuestId(questId))
8910 {
8911 QuestProperties const* qst = questLogEntry->getQuestProperties();
8912
8913 sQuestMgr.SendQuestUpdateFailedTimer(qst, this);
8914
8915 if (const auto questScript = questLogEntry->getQuestScript())
8916 questScript->OnQuestCancel(this);
8917
8918 questLogEntry->sendQuestFailed(true);
8919 }
8920}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exitInstance()

bool Player::exitInstance ( )

Definition at line 2310 of file Player.cpp.

2311{
2312 if (getBGEntryPosition().isSet())
2313 {
2316
2317 return true;
2318 }
2319
2320 return false;
2321}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fillRandomBattlegroundReward()

void Player::fillRandomBattlegroundReward ( bool  wonBattleground,
uint32_t honorPoints,
uint32_t arenaPoints 
)

Definition at line 8583 of file Player.cpp.

8584{
8585 auto honorForSingleKill = HonorHandler::CalculateHonorPointsForKill(this->getLevel(), this->getLevel());
8586
8587 if (wonBattleground)
8588 {
8589 if (this->m_hasWonRbgToday)
8590 {
8591 honorPoints = worldConfig.bg.honorableKillsRbg * honorForSingleKill;
8592 arenaPoints = worldConfig.bg.honorableArenaWinRbg;
8593 }
8594 else
8595 {
8596 honorPoints = worldConfig.bg.firstRbgHonorValueToday * honorForSingleKill;
8597 arenaPoints = worldConfig.bg.firstRbgArenaHonorValueToday;
8598 }
8599 }
8600 else
8601 {
8602 honorPoints = worldConfig.bg.honorByLosingRbg * honorForSingleKill;
8603 arenaPoints = worldConfig.bg.honorByLosingArenaRbg;
8604 }
8605}
static int32_t CalculateHonorPointsForKill(uint32_t playerLevel, uint32_t victimLevel)
bool m_hasWonRbgToday
Definition Player.hpp:1462
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findFreeActivePetSlot()

std::optional< uint8_t > Player::findFreeActivePetSlot ( ) const

Definition at line 12349 of file Player.cpp.

12350{
12351 std::optional<uint8_t> foundSlot = std::nullopt;
12353 {
12354 if (!hasPetInSlot(i))
12355 {
12356 foundSlot = i;
12357 break;
12358 }
12359 }
12360 return foundSlot;
12361}
@ PET_SLOT_FIRST_ACTIVE_SLOT
bool hasPetInSlot(uint8_t slot) const
Definition Player.cpp:12344
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findFreeStablePetSlot()

std::optional< uint8_t > Player::findFreeStablePetSlot ( ) const

Definition at line 12363 of file Player.cpp.

12364{
12365 std::optional<uint8_t> foundSlot = std::nullopt;
12367 {
12369 break;
12370
12371 if (!hasPetInSlot(i))
12372 {
12373 foundSlot = i;
12374 break;
12375 }
12376 }
12377 return foundSlot;
12378}
@ PET_SLOT_LAST_STABLE_SLOT
Here is the call graph for this function:
Here is the caller graph for this function:

◆ forceZoneUpdate()

void Player::forceZoneUpdate ( )

Definition at line 2151 of file Player.cpp.

2152{
2153 if (!m_WorldMap)
2154 return;
2155
2156 if (auto areaTableEntry = this->GetArea())
2157 {
2158 if (areaTableEntry->zone && areaTableEntry->zone != m_zoneId)
2159 zoneUpdate(areaTableEntry->zone);
2160
2162 }
2163}
void sendInitialWorldstates()
Definition Player.cpp:9772
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getActiveSpec()

PlayerSpec & Player::getActiveSpec ( )

Definition at line 9393 of file Player.cpp.

9394{
9395#ifdef FT_DUAL_SPEC
9396 return m_specs[m_talentActiveSpec];
9397#else
9398 return m_spec;
9399#endif
9400}
PlayerSpec m_spec
Definition Player.hpp:1996
Here is the caller graph for this function:

◆ getAFKReason()

std::string Player::getAFKReason ( ) const

Definition at line 2397 of file Player.cpp.

2397{ return afkReason; }
std::string afkReason
Definition Player.hpp:1119

◆ getAreaSpiritHealerGuid()

uint64_t Player::getAreaSpiritHealerGuid ( ) const

Definition at line 7781 of file Player.cpp.

7781{ return m_areaSpiritHealerGuid; }
uint64_t m_areaSpiritHealerGuid
Definition Player.hpp:1223
Here is the caller graph for this function:

◆ getArenaFaction()

uint8_t Player::getArenaFaction ( ) const

Definition at line 865 of file Player.cpp.

865{ return playerData()->player_bytes_3.s.arena_faction; }
player_bytes_3_union player_bytes_3
struct player_bytes_3_union::parts s
Here is the call graph for this function:

◆ getArenaPoints()

uint32_t Player::getArenaPoints ( ) const

Definition at line 8102 of file Player.cpp.

8102{ return m_arenaPoints; }

◆ getArenaTeam()

ArenaTeam * Player::getArenaTeam ( uint8_t  type)

Definition at line 8070 of file Player.cpp.

8070{ return m_arenaTeams[type]; }
std::array< ArenaTeam *, NUM_ARENA_TEAM_TYPES > m_arenaTeams
Definition Player.hpp:1357
Here is the caller graph for this function:

◆ getArmorProficiency()

uint32_t Player::getArmorProficiency ( ) const

Definition at line 5223 of file Player.cpp.

5224{
5225 return armorProficiency;
5226}
Here is the caller graph for this function:

◆ getAuraVision()

uint8_t Player::getAuraVision ( ) const

◆ getBankBagSlotItemGuid()

uint64_t Player::getBankBagSlotItemGuid ( uint8_t  slot) const

Definition at line 954 of file Player.cpp.

954{ return playerData()->bank_bag_slot[slot]; }
std::array< uint64_t, WOWPLAYER_BANK_BAG_SLOT_COUNT > bank_bag_slot
Here is the call graph for this function:

◆ getBankSlotItemGuid()

uint64_t Player::getBankSlotItemGuid ( uint8_t  slot) const

Definition at line 951 of file Player.cpp.

951{ return playerData()->bank_slot[slot]; }
std::array< uint64_t, WOWPLAYER_BANK_SLOT_COUNT > bank_slot
Here is the call graph for this function:

◆ getBankSlots()

uint8_t Player::getBankSlots ( ) const

Definition at line 844 of file Player.cpp.

player_bytes_2_union player_bytes_2
struct player_bytes_2_union::parts s
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBanReason()

std::string Player::getBanReason ( ) const

Definition at line 2342 of file Player.cpp.

2342{ return m_banreason; }
std::string m_banreason
Definition Player.hpp:1107
Here is the caller graph for this function:

◆ getBaseFactionStanding()

int32_t Player::getBaseFactionStanding ( uint32_t  faction)

Definition at line 11440 of file Player.cpp.

11441{
11442 const ReputationMap::iterator itr = m_reputation.find(faction);
11443 if (itr != m_reputation.end())
11444 return itr->second->baseStanding;
11445 return 0;
11446}

◆ getBattleground()

Battleground * Player::getBattleground ( ) const

Definition at line 8546 of file Player.cpp.

8546{ return m_bg; }
Here is the caller graph for this function:

◆ getBGEntryInstanceId()

int32_t Player::getBGEntryInstanceId ( ) const

Definition at line 7831 of file Player.cpp.

7831{ return m_bgEntryData.instanceId; }
BGEntryData m_bgEntryData
Definition Player.hpp:1261
Here is the caller graph for this function:

◆ getBGEntryMapId()

uint32_t Player::getBGEntryMapId ( ) const

Definition at line 7830 of file Player.cpp.

7830{ return m_bgEntryData.mapId; }
Here is the caller graph for this function:

◆ getBGEntryPosition()

LocationVector Player::getBGEntryPosition ( ) const

Definition at line 7829 of file Player.cpp.

7829{ return m_bgEntryData.location; }
LocationVector location
Definition Player.hpp:1257
Here is the caller graph for this function:

◆ getBgQueueType()

uint32_t Player::getBgQueueType ( ) const

Definition at line 8575 of file Player.cpp.

8575{ return this->m_bgQueueType; }
uint32_t m_bgQueueType
Definition Player.hpp:1464
Here is the caller graph for this function:

◆ getBgTeam()

PlayerTeam Player::getBgTeam ( ) const

Definition at line 2775 of file Player.cpp.

@ TEAM_ALLIANCE
@ TEAM_HORDE
uint32_t m_bgTeam
Definition Player.hpp:740
Here is the caller graph for this function:

◆ getBindMapId()

uint32_t Player::getBindMapId ( ) const

Definition at line 7817 of file Player.cpp.

7817{ return m_bindData.mapId; }
BindData m_bindData
Definition Player.hpp:1243
Here is the caller graph for this function:

◆ getBindPosition()

LocationVector Player::getBindPosition ( ) const

Definition at line 7816 of file Player.cpp.

7816{ return m_bindData.location; }
LocationVector location
Definition Player.hpp:1239
Here is the caller graph for this function:

◆ getBindZoneId()

uint32_t Player::getBindZoneId ( ) const

Definition at line 7818 of file Player.cpp.

7818{ return m_bindData.zoneId; }
uint32_t zoneId
Definition Player.hpp:1241
Here is the caller graph for this function:

◆ getBlockChance()

float Player::getBlockChance ( )

Definition at line 15383 of file Player.cpp.

15384{
15385 float chance = BASE_BLOCK_CHANCE;
15386 chance += calcRating(CR_BLOCK);
15387 chance += getBlockFromSpell();
15388
15389 return std::max(chance, 0.0f); // Make sure we don't have a negative chance
15390}
@ CR_BLOCK
#define BASE_BLOCK_CHANCE
float getBlockFromSpell() const
Definition Unit.hpp:1518
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBlockDamageReduction()

uint32_t Player::getBlockDamageReduction ( )

Definition at line 13324 of file Player.cpp.

13325{
13327 if (item == nullptr || item->getItemProperties()->InventoryType != INVTYPE_SHIELD)
13328 return 0;
13329
13330 float block_multiplier = (100.0f + this->m_modBlockAbsorbValue) / 100.0f;
13331 if (block_multiplier < 1.0f)
13332 block_multiplier = 1.0f;
13333
13334 return Util::float2int32((item->getItemProperties()->Block + this->m_modBlockValueFromSpells + this->getCombatRating(CR_BLOCK) + this->getStat(STAT_STRENGTH) / 2.0f - 1.0f) * block_multiplier);
13335}
@ INVTYPE_SHIELD
uint32_t m_modBlockAbsorbValue
Definition Player.hpp:2048
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBlockPercentage()

float Player::getBlockPercentage ( ) const

Definition at line 1081 of file Player.cpp.

1081{ return playerData()->block_pct; }
float block_pct
Here is the call graph for this function:

◆ getBoundInstance()

InstancePlayerBind * Player::getBoundInstance ( uint32_t  mapId,
InstanceDifficulty::Difficulties  difficulty,
bool  withExpired = false 
)

Definition at line 12803 of file Player.cpp.

12804{
12805#if VERSION_STRING > TBC
12806 // some instances only have one difficulty
12807 auto const* mapDiff = getDownscaledMapDifficultyData(mapId, difficulty);
12808 if (!mapDiff)
12809 return nullptr;
12810#endif
12811
12812 BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapId);
12813 if (itr != m_boundInstances[difficulty].end())
12814 if (itr->second.extendState || withExpired)
12815 return &itr->second;
12816 return nullptr;
12817}
WDB::Structures::MapDifficulty const * getDownscaledMapDifficultyData(uint32_t mapId, InstanceDifficulty::Difficulties &difficulty)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBoundInstances()

BoundInstancesMap & Player::getBoundInstances ( InstanceDifficulty::Difficulties  difficulty)
inline

Definition at line 2128 of file Player.hpp.

2128{ return m_boundInstances[difficulty]; }

◆ getBuybackPriceSlot()

uint32_t Player::getBuybackPriceSlot ( uint8_t  slot) const

Definition at line 1242 of file Player.cpp.

1242{ return playerData()->field_buy_back_price[slot]; }
std::array< uint32_t, WOWPLAYER_BUY_BACK_COUNT > field_buy_back_price
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBuybackTimestampSlot()

uint32_t Player::getBuybackTimestampSlot ( uint8_t  slot) const

Definition at line 1245 of file Player.cpp.

1245{ return playerData()->field_buy_back_timestamp[slot]; }
std::array< uint32_t, WOWPLAYER_BUY_BACK_COUNT > field_buy_back_timestamp
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCharter()

Charter const * Player::getCharter ( uint8_t  charterType)

Definition at line 7836 of file Player.cpp.

7836{ return m_charters[charterType]; }
Here is the caller graph for this function:

◆ getCoinage()

uint64_t Player::getCoinage ( ) const

Definition at line 1184 of file Player.cpp.

1184{ return playerData()->field_coinage; }
uint32_t field_coinage
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCombatRating()

uint32_t Player::getCombatRating ( uint8_t  combatRating) const

Definition at line 1276 of file Player.cpp.

1276{ return playerData()->field_combat_rating[combatRating]; }
std::array< uint32_t, WOWPLAYER_COMBAT_RATING_COUNT > field_combat_rating
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getComboPoints()

int8_t Player::getComboPoints ( ) const

Definition at line 5361 of file Player.cpp.

5362{
5363 return m_comboPoints;
5364}
Here is the caller graph for this function:

◆ getComboPointTarget()

uint64_t Player::getComboPointTarget ( ) const

Definition at line 5356 of file Player.cpp.

5357{
5358 return m_comboTarget;
5359}
Here is the caller graph for this function:

◆ getCorpseInstanceId()

int32_t Player::getCorpseInstanceId ( ) const

Definition at line 7430 of file Player.cpp.

7431{
7432 return m_corpseData.instanceId;
7433}
CorpseData m_corpseData
Definition Player.hpp:1212
Here is the caller graph for this function:

◆ getCorpseLocation()

LocationVector Player::getCorpseLocation ( ) const

Definition at line 7425 of file Player.cpp.

7426{
7427 return m_corpseData.location;
7428}
LocationVector location
Definition Player.hpp:1209

◆ getCreatureWhenICanInteract()

Creature * Player::getCreatureWhenICanInteract ( WoWGuid const guid,
uint32_t  npcflagmask 
)

Definition at line 16884 of file Player.cpp.

16885{
16886 // unit checks
16887 if (!guid)
16888 return nullptr;
16889
16890 if (!IsInWorld())
16891 return nullptr;
16892
16893 if (isInFlight())
16894 return nullptr;
16895
16896 Creature* creature = getWorldMapCreature(guid.getRawGuid());
16897 if (!creature)
16898 return nullptr;
16899
16900 // Deathstate checks
16901 if (!isAlive() && !(creature->GetCreatureProperties()->typeFlags & CREATURE_FLAG1_GHOST))
16902 return nullptr;
16903
16904 // alive or spirit healer
16905 if (!creature->isAlive() && !(creature->GetCreatureProperties()->typeFlags & CREATURE_FLAG1S_DEAD_INTERACT))
16906 return nullptr;
16907
16908 // appropriate npc type
16909 if (npcflagmask && !(creature->getNpcFlags() & npcflagmask))
16910 return nullptr;
16911
16912 // not allow interaction under control, but allow with own pets
16913 if (creature->getCharmGuid())
16914 return nullptr;
16915
16916 // not unfriendly/hostile
16917 if (this->isHostileTo(creature))
16918 return nullptr;
16919
16920 // not too far
16921 if (!creature->IsWithinDistInMap(this, creature->getCombatReach() + 4.0f))
16922 return nullptr;
16923
16924 return creature;
16925}
@ CREATURE_FLAG1S_DEAD_INTERACT
@ CREATURE_FLAG1_GHOST
CreatureProperties const * GetCreatureProperties()
Creature * getWorldMapCreature(const uint64_t &guid) const
Definition Object.cpp:4597
bool IsWithinDistInMap(Object *obj, const float dist2compare) const
Definition Object.cpp:3592
bool isHostileTo(Object *target)
Definition Object.cpp:4031
bool isInFlight() const
Definition Player.cpp:10770
uint64_t getNpcFlags() const
Definition Unit.cpp:1439
float getCombatReach() const
Definition Unit.cpp:1249
bool isAlive() const
Definition Unit.cpp:7871
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrencyTokenSlotItemGuid()

uint64_t Player::getCurrencyTokenSlotItemGuid ( uint8_t  slot) const

Definition at line 971 of file Player.cpp.

971{ return playerData()->currencytoken_slot[slot]; }
Here is the call graph for this function:

◆ GetDamageDoneMod()

int32_t Player::GetDamageDoneMod ( uint16_t  school)
inlineoverridevirtual

Reimplemented from Unit.

Definition at line 1939 of file Player.hpp.

1940 {
1941 if (school >= TOTAL_SPELL_SCHOOLS)
1942 return 0;
1943
1944 return static_cast<int32_t>(getModDamageDonePositive(school)) - static_cast<int32_t>(getModDamageDoneNegative(school));
1945 }
@ TOTAL_SPELL_SCHOOLS
Definition School.hpp:19
Here is the caller graph for this function:

◆ GetDamageDonePctMod()

float Player::GetDamageDonePctMod ( uint16_t  school)
inlineoverridevirtual

Reimplemented from Unit.

Definition at line 1947 of file Player.hpp.

1948 {
1949 if (school >= TOTAL_SPELL_SCHOOLS)
1950 return 0;
1951
1952 return getModDamageDonePct(static_cast<uint8_t>(school));
1953 }
float getModDamageDonePct(uint8_t shool) const
Definition Player.cpp:1209

◆ getDbcClassEntry()

WDB::Structures::ChrClassesEntry const * Player::getDbcClassEntry ( )

Definition at line 2637 of file Player.cpp.

2637{ return m_dbcClass; };
Here is the caller graph for this function:

◆ getDbcRaceEntry()

WDB::Structures::ChrRacesEntry const * Player::getDbcRaceEntry ( )

Definition at line 2636 of file Player.cpp.

2636{ return m_dbcRace; };
Here is the caller graph for this function:

◆ getDefenseChance()

float Player::getDefenseChance ( uint32_t  opLevel)

Definition at line 15334 of file Player.cpp.

15335{
15336 float chance = getSkillLineCurrent(SKILL_DEFENSE, true) - (opLevel * 5.0f);
15337 chance += calcRating(CR_DEFENSE_SKILL);
15338 chance = floorf(chance) * 0.04f; // defense skill is treated as an integer on retail
15339
15340 return chance;
15341}
@ CR_DEFENSE_SKILL
@ SKILL_DEFENSE
Definition Skill.hpp:38
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDeletedSpellSet()

SpellSet const & Player::getDeletedSpellSet ( ) const

Definition at line 3965 of file Player.cpp.

3966{
3967 return m_deletedSpellSet;
3968}

◆ getDifficulty()

InstanceDifficulty::Difficulties Player::getDifficulty ( bool  isRaid) const
inline

Definition at line 1159 of file Player.hpp.

Here is the caller graph for this function:

◆ getDodgeChance()

float Player::getDodgeChance ( )

Definition at line 15343 of file Player.cpp.

15344{
15345 const float crit_to_dodge[MAX_PLAYER_CLASSES] =
15346 {
15347 0.0f, // empty
15348 1.1f, // Warrior
15349 1.0f, // Paladin
15350 1.6f, // Hunter
15351 2.0f, // Rogue
15352 1.0f, // Priest
15353 1.0f, // DK?
15354 1.0f, // Shaman
15355 1.0f, // Mage
15356 1.0f, // Warlock
15357 0.0f, // empty
15358 1.7f // Druid
15359 };
15360
15361 uint32_t playerClass = getClass();
15362 float chance = 0.0f;
15363 uint32_t level = getLevel();
15364
15365 if (level > worldConfig.player.playerGeneratedInformationByLevelCap)
15366 level = worldConfig.player.playerGeneratedInformationByLevelCap;
15367
15368 // Base dodge + dodge from agility
15369 auto baseCrit = sGtChanceToMeleeCritBaseStore.lookupEntry(playerClass - 1);
15370 auto critPerAgi = sGtChanceToMeleeCritStore.lookupEntry(level - 1 + (playerClass - 1) * 100);
15372
15373 float tmp = 100.0f * (baseCrit->val + agi * critPerAgi->val);
15374 tmp *= crit_to_dodge[playerClass];
15375 chance += tmp;
15376
15377 chance += calcRating(CR_DODGE);
15378 chance += getDodgeFromSpell();
15379
15380 return std::max(chance, 0.0f); // Make sure we don't have a negative chance
15381}
@ CR_DODGE
@ MAX_PLAYER_CLASSES
SERVER_DECL WDB::WDBContainer< WDB::Structures::GtChanceToMeleeCritEntry > sGtChanceToMeleeCritStore
SERVER_DECL WDB::WDBContainer< WDB::Structures::GtChanceToMeleeCritBaseEntry > sGtChanceToMeleeCritBaseStore
float getDodgeFromSpell() const
Definition Unit.hpp:1520
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDodgePercentage()

float Player::getDodgePercentage ( ) const

Definition at line 1084 of file Player.cpp.

1084{ return playerData()->dodge_pct; }
float dodge_pct
Here is the call graph for this function:

◆ getDrunkStateByValue()

PlayerBytes3_DrunkValue Player::getDrunkStateByValue ( uint16_t  value)
static

Definition at line 11851 of file Player.cpp.

11852{
11853 if (value >= 23000)
11854 return DRUNKEN_SMASHED;
11855
11856 if (value >= 12800)
11857 return DRUNKEN_DRUNK;
11858
11859 if (value & 0xFFFE)
11860 return DRUNKEN_TIPSY;
11861
11862 return DRUNKEN_SOBER;
11863}
@ DRUNKEN_TIPSY
@ DRUNKEN_DRUNK
@ DRUNKEN_SOBER
@ DRUNKEN_SMASHED
Here is the caller graph for this function:

◆ getDrunkValue()

uint8_t Player::getDrunkValue ( ) const

Definition at line 858 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDuelArbiter()

uint64_t Player::getDuelArbiter ( ) const

Definition at line 765 of file Player.cpp.

765{ return playerData()->duel_arbiter; }
uint64_t duel_arbiter
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDuelPlayer()

Player * Player::getDuelPlayer ( ) const

Definition at line 11874 of file Player.cpp.

11874{ return m_duelPlayer; }
Here is the caller graph for this function:

◆ getDuelState()

uint8_t Player::getDuelState ( ) const

Definition at line 12129 of file Player.cpp.

12129{ return m_duelState; }
Here is the caller graph for this function:

◆ getDuelStatus()

uint8_t Player::getDuelStatus ( ) const

Definition at line 12126 of file Player.cpp.

12126{ return m_duelStatus; }
uint8_t m_duelStatus
Definition Player.hpp:1727

◆ getDuelTeam()

uint32_t Player::getDuelTeam ( ) const

Definition at line 870 of file Player.cpp.

870{ return playerData()->duel_team; }
uint32_t duel_team
Here is the call graph for this function:

◆ getDungeonDifficulty()

uint8_t Player::getDungeonDifficulty ( )

Definition at line 7241 of file Player.cpp.

7242{
7243 return m_dungeonDifficulty;
7244}
Here is the caller graph for this function:

◆ getEnabledActionBars()

uint8_t Player::getEnabledActionBars ( ) const

Definition at line 1234 of file Player.cpp.

player_field_bytes_union player_field_bytes
struct player_field_bytes_union::parts s
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExaltedCount()

uint32_t Player::getExaltedCount ( )

Definition at line 11747 of file Player.cpp.

11748{
11749 uint32_t exaltedCount = 0;
11750
11751 auto itr = m_reputation.begin();
11752 while (itr != m_reputation.end())
11753 {
11754 const int32_t exaltedReputation = 42000;
11755 if (itr->second->standing >= exaltedReputation)
11756 ++exaltedCount;
11757 ++itr;
11758 }
11759 return exaltedCount;
11760}

◆ getExpertise()

uint32_t Player::getExpertise ( ) const

Definition at line 1091 of file Player.cpp.

1091{ return playerData()->expertise; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExploredZone()

uint32_t Player::getExploredZone ( uint32_t  idx) const

Definition at line 1122 of file Player.cpp.

1123{
1125 return playerData()->explored_zones[idx];
1126 return 0;
1127}
static constexpr uint8_t WOWPLAYER_EXPLORED_ZONES_COUNT
Definition WoWPlayer.hpp:75
std::array< uint32_t, WOWPLAYER_EXPLORED_ZONES_COUNT > explored_zones
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFace()

uint8_t Player::getFace ( ) const

Definition at line 827 of file Player.cpp.

827{ return playerData()->player_bytes.s.face; }
player_bytes_union player_bytes
struct player_bytes_union::parts s
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFacialFeatures()

uint8_t Player::getFacialFeatures ( ) const

Definition at line 841 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFactionStanding()

int32_t Player::getFactionStanding ( uint32_t  faction)

Definition at line 11432 of file Player.cpp.

11433{
11434 const ReputationMap::iterator itr = m_reputation.find(faction);
11435 if (itr != m_reputation.end())
11436 return itr->second->standing;
11437 return 0;
11438}
Here is the caller graph for this function:

◆ getFactionStandingRank()

Standing Player::getFactionStandingRank ( uint32_t  faction)

Definition at line 11519 of file Player.cpp.

11520{
11522}
static Standing getReputationRankFromStanding(int32_t value)
Definition Player.cpp:11524
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFallDisabledUntil()

time_t Player::getFallDisabledUntil ( ) const

Definition at line 2047 of file Player.cpp.

2047{ return m_fallDisabledUntil; }
time_t m_fallDisabledUntil
Definition Player.hpp:635
Here is the caller graph for this function:

◆ getFarsightGuid()

uint64_t Player::getFarsightGuid ( ) const

Definition at line 975 of file Player.cpp.

975{ return playerData()->farsight_guid; }
uint64_t farsight_guid
Here is the call graph for this function:

◆ getFinishedDailies()

std::set< uint32_t > Player::getFinishedDailies ( ) const

Definition at line 8882 of file Player.cpp.

8883{
8884 std::lock_guard<std::mutex> lock(m_mutextDailies);
8885 return m_finishedDailies;
8886}
Here is the caller graph for this function:

◆ getFinishedQuests()

std::set< uint32_t > Player::getFinishedQuests ( ) const

Definition at line 9068 of file Player.cpp.

9068{ return m_finishedQuests; }

◆ getForcedReputationRank()

Standing const * Player::getForcedReputationRank ( WDB::Structures::FactionTemplateEntry const factionTemplateEntry) const

Definition at line 11552 of file Player.cpp.

11553{
11554 const auto itr = m_forcedReactions.find(factionTemplateEntry->Faction);
11555 return itr != m_forcedReactions.end() ? &itr->second : nullptr;
11556}
Here is the caller graph for this function:

◆ getFreePetNumber()

uint8_t Player::getFreePetNumber ( )

Definition at line 12325 of file Player.cpp.

12326{
12327 for (uint8_t i = 1; i < m_maxPetNumber; ++i)
12328 if (!m_cachedPets.contains(i))
12329 return i;
12330
12331 m_maxPetNumber += 1;
12332 return m_maxPetNumber;
12333}

◆ getFreePrimaryProfessionPoints()

uint32_t Player::getFreePrimaryProfessionPoints ( ) const

Definition at line 1043 of file Player.cpp.

1044{
1045#if VERSION_STRING < Cata
1047#else
1049#endif
1050}
uint32_t character_points_1
uint32_t character_points_2
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFreeQuestSlot()

uint8_t Player::getFreeQuestSlot ( ) const

Definition at line 8850 of file Player.cpp.

8851{
8852 for (uint8_t slotId = 0; slotId < MAX_QUEST_LOG_SIZE; ++slotId)
8853 if (m_questlog[slotId] == nullptr)
8854 return slotId;
8855
8856 return MAX_QUEST_LOG_SIZE + 1;
8857}
Here is the caller graph for this function:

◆ getFreeTalentPoints()

uint32_t Player::getFreeTalentPoints ( ) const

Definition at line 1030 of file Player.cpp.

1031{
1032#if VERSION_STRING < Cata
1034#else
1035 return m_specs[m_talentActiveSpec].getTalentPoints();
1036#endif
1037}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGlyph()

uint32_t Player::getGlyph ( uint16_t  slot) const

Definition at line 1309 of file Player.cpp.

1309{ return playerData()->field_glyphs[slot]; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGlyphsEnabled()

uint32_t Player::getGlyphsEnabled ( ) const

Definition at line 1312 of file Player.cpp.

1312{ return playerData()->glyphs_enabled; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGlyphSlot()

uint32_t Player::getGlyphSlot ( uint16_t  slot) const

Definition at line 1306 of file Player.cpp.

1306{ return playerData()->field_glyph_slots[slot]; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGroup()

Group * Player::getGroup ( )

Definition at line 7887 of file Player.cpp.

7887{ return m_playerInfo ? m_playerInfo->m_Group : nullptr; }

◆ getGroupInviterId()

uint32_t Player::getGroupInviterId ( ) const

Definition at line 7882 of file Player.cpp.

7882{ return m_grouIdpInviterId; }
uint32_t m_grouIdpInviterId
Definition Player.hpp:1318
Here is the caller graph for this function:

◆ getGroupStatus()

uint16_t Player::getGroupStatus ( )

Definition at line 7914 of file Player.cpp.

7915{
7917 if (isPvpFlagSet())
7918 status |= MEMBER_STATUS_PVP;
7919 if (getDeathState() == CORPSE)
7920 status |= MEMBER_STATUS_DEAD;
7921 else if (isDead())
7922 status |= MEMBER_STATUS_GHOST;
7923 if (isFfaPvpFlagSet())
7924 status |= MEMBER_STATUS_PVP_FFA;
7926 status |= MEMBER_STATUS_AFK;
7928 status |= MEMBER_STATUS_DND;
7929
7930 return status;
7931}
@ MEMBER_STATUS_AFK
Definition Group.h:91
@ MEMBER_STATUS_PVP
Definition Group.h:86
@ MEMBER_STATUS_ONLINE
Definition Group.h:85
@ MEMBER_STATUS_DEAD
Definition Group.h:87
@ MEMBER_STATUS_GHOST
Definition Group.h:88
@ MEMBER_STATUS_DND
Definition Group.h:92
@ MEMBER_STATUS_PVP_FFA
Definition Group.h:89
@ PLAYER_FLAG_AFK
@ PLAYER_FLAG_DND
bool isFfaPvpFlagSet() const override
Definition Player.cpp:9819
bool isPvpFlagSet() const override
Definition Player.cpp:9781
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGroupUpdateFlags()

uint32_t Player::getGroupUpdateFlags ( ) const

Definition at line 7900 of file Player.cpp.

7900{ return m_groupUpdateFlags; }
Here is the caller graph for this function:

◆ getGuild()

Guild * Player::getGuild ( ) const

Definition at line 7865 of file Player.cpp.

7865{ return getGuildId() ? sGuildMgr.getGuildById(getGuildId()) : nullptr; }
#define sGuildMgr
Definition GuildMgr.hpp:63
uint32_t getGuildId() const
Definition Player.cpp:788
Here is the call graph for this function:

◆ getGuildId()

uint32_t Player::getGuildId ( ) const

Definition at line 788 of file Player.cpp.

789{
790#if VERSION_STRING < Cata
791 return playerData()->guild_id;
792#else
793 return static_cast<uint32_t>(objectData()->data);
794#endif
795}
const WoWObject * objectData() const
Definition Object.hpp:123
uint64_t data
Definition WoWObject.hpp:46
uint32_t guild_id
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGuildLevel()

uint32_t Player::getGuildLevel ( ) const

Definition at line 816 of file Player.cpp.

816{ return playerData()->guild_level; }
Here is the call graph for this function:

◆ getGuildRank()

uint32_t Player::getGuildRank ( ) const

Definition at line 812 of file Player.cpp.

812{ return playerData()->guild_rank; }
uint32_t guild_rank
Here is the call graph for this function:

◆ getGuildRankFromDB()

uint32_t Player::getGuildRankFromDB ( )

Definition at line 7868 of file Player.cpp.

7869{
7870 if (auto result = CharacterDatabase.Query("SELECT playerid, guildRank FROM guild_members WHERE playerid = %u", WoWGuid::getGuidLowPartFromUInt64(getGuid())))
7871 {
7872 Field* fields = result->Fetch();
7873 return fields[1].asUint32();
7874 }
7875
7876 return 0;
7877}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGuildTimestamp()

uint32_t Player::getGuildTimestamp ( ) const

Definition at line 873 of file Player.cpp.

873{ return playerData()->guild_timestamp; }
uint32_t guild_timestamp
Here is the call graph for this function:

◆ getHairColor()

uint8_t Player::getHairColor ( ) const

Definition at line 833 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHairStyle()

uint8_t Player::getHairStyle ( ) const

Definition at line 830 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHealthFromSpell()

uint32_t Player::getHealthFromSpell ( )
inline

Definition at line 878 of file Player.hpp.

878{ return m_healthFromSpell; }
uint32_t m_healthFromSpell
Definition Player.hpp:2217
Here is the caller graph for this function:

◆ getHitFromSpell()

float Player::getHitFromSpell ( )
inline

Definition at line 2036 of file Player.hpp.

2036{ return m_hitFromSpell; }
float m_hitFromSpell
Definition Player.hpp:2215
Here is the caller graph for this function:

◆ getHonor()

uint32_t Player::getHonor ( ) const

Definition at line 8147 of file Player.cpp.

8147{ return m_honorPoints; }

◆ getHonorless()

uint32_t Player::getHonorless ( ) const

Definition at line 8192 of file Player.cpp.

8192{ return m_honorless; }
Here is the caller graph for this function:

◆ getHonorToday()

uint32_t Player::getHonorToday ( ) const

Definition at line 8190 of file Player.cpp.

8190{ return m_honorToday; }

◆ getHonorYesterday()

uint32_t Player::getHonorYesterday ( ) const

Definition at line 8191 of file Player.cpp.

8191{ return m_honorYesterday; }
uint32_t m_honorYesterday
Definition Player.hpp:1389

◆ getInitialFactionId()

uint32_t Player::getInitialFactionId ( )

Definition at line 11812 of file Player.cpp.

11813{
11814 if (const auto raceEntry = sChrRacesStore.lookupEntry(getRace()))
11815 return raceEntry->faction_id;
11816
11817 return 0;
11818}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInitialTeam()

uint32_t Player::getInitialTeam ( ) const

Definition at line 2779 of file Player.cpp.

2779{ return m_dbcRace->team_id == 7 ? TEAM_ALLIANCE : TEAM_HORDE; }
Here is the caller graph for this function:

◆ getInstanceSave()

InstanceSaved * Player::getInstanceSave ( uint32_t  mapId,
bool  isRaid 
)

Definition at line 12819 of file Player.cpp.

12820{
12821 InstancePlayerBind* pBind = getBoundInstance(mapId, getDifficulty(isRaid));
12822 InstanceSaved* pSave = pBind ? pBind->save : nullptr;
12823 if (!pBind || !pBind->perm)
12824 if (auto group = getGroup())
12825 if (InstanceGroupBind* groupBind = group->getBoundInstance(getDifficulty(isRaid), mapId))
12826 pSave = groupBind->save;
12827
12828 return pSave;
12829}
InstancePlayerBind * getBoundInstance(uint32_t mapId, InstanceDifficulty::Difficulties difficulty, bool withExpired=false)
Definition Player.cpp:12803
InstanceDifficulty::Difficulties getDifficulty(bool isRaid) const
Definition Player.hpp:1159
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInventorySlotItemGuid()

uint64_t Player::getInventorySlotItemGuid ( uint8_t  slot) const

Definition at line 945 of file Player.cpp.

945{ return playerData()->inventory_slot[slot]; }
std::array< uint64_t, WOWPLAYER_INVENTORY_SLOT_COUNT > inventory_slot
Here is the call graph for this function:

◆ getInviteArenaTeamId()

uint32_t Player::getInviteArenaTeamId ( ) const

Definition at line 8129 of file Player.cpp.

8129{ return m_inviteArenaTeamId; }
uint32_t m_inviteArenaTeamId
Definition Player.hpp:1359
Here is the caller graph for this function:

◆ getInvitedByGuildId()

uint32_t Player::getInvitedByGuildId ( ) const

Definition at line 7864 of file Player.cpp.

7864{ return m_invitedByGuildId; }
uint32_t m_invitedByGuildId
Definition Player.hpp:1287
Here is the caller graph for this function:

◆ getItemInterface()

ItemInterface * Player::getItemInterface ( ) const

Definition at line 6934 of file Player.cpp.

6935{
6936 return m_itemInterface.get();
6937}

◆ getKillsLifetime()

uint32_t Player::getKillsLifetime ( ) const

Definition at line 8210 of file Player.cpp.

8210{ return m_killsLifetime; }
uint32_t m_killsLifetime
Definition Player.hpp:1393

◆ getKillsToday()

uint32_t Player::getKillsToday ( ) const

Definition at line 8209 of file Player.cpp.

8209{ return m_killsToday; }
uint32_t m_killsToday
Definition Player.hpp:1392

◆ getKillsYesterday()

uint32_t Player::getKillsYesterday ( ) const

Definition at line 8211 of file Player.cpp.

8211{ return m_killsYesterday; }
uint32_t m_killsYesterday
Definition Player.hpp:1394

◆ getKnownCurrencies()

uint64_t Player::getKnownCurrencies ( ) const

Definition at line 989 of file Player.cpp.

989{ return playerData()->field_known_currencies; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLastBattlegroundPetId()

uint8_t Player::getLastBattlegroundPetId ( ) const

Definition at line 12658 of file Player.cpp.

12658{ return m_battlegroundLastPetId; }
uint8_t m_battlegroundLastPetId
Definition Player.hpp:1805
Here is the caller graph for this function:

◆ getLastBattlegroundPetSpell()

uint32_t Player::getLastBattlegroundPetSpell ( ) const

Definition at line 12660 of file Player.cpp.

uint32_t m_battlegroundLastPetSpell
Definition Player.hpp:1806
Here is the caller graph for this function:

◆ getLastGroupPosition()

LocationVector Player::getLastGroupPosition ( ) const

Definition at line 7956 of file Player.cpp.

7956{ return m_lastGroupPosition; }
LocationVector m_lastGroupPosition
Definition Player.hpp:1322

◆ getLevelGrouping()

uint32_t Player::getLevelGrouping ( )

Definition at line 8616 of file Player.cpp.

8617{
8618 uint32_t level = getLevel();
8619
8620 if (level < 10)
8621 return 0;
8622 if (level < 20)
8623 return 1;
8624 if (level < 30)
8625 return 2;
8626 if (level < 40)
8627 return 3;
8628 if (level < 50)
8629 return 4;
8630 if (level < 60)
8631 return 5;
8632 if (level < 70)
8633 return 6;
8634 if (level < 80)
8635 return 7;
8636
8637 return 8;
8638}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLifetimeHonorableKills()

uint32_t Player::getLifetimeHonorableKills ( ) const

Definition at line 1263 of file Player.cpp.

uint32_t field_lifetime_honorable_kills
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLoginFlag()

uint32_t Player::getLoginFlag ( ) const

Definition at line 2642 of file Player.cpp.

2642{ return m_loginFlag; }
uint32_t m_loginFlag
Definition Player.hpp:737

◆ getLootGuid()

const uint64_t & Player::getLootGuid ( ) const

Definition at line 10787 of file Player.cpp.

10787{ return m_lootGuid; }
uint64_t m_lootGuid
Definition Player.hpp:1648
Here is the caller graph for this function:

◆ getMainMeleeDamage()

uint32_t Player::getMainMeleeDamage ( uint32_t  attackPowerOverride)

Definition at line 16836 of file Player.cpp.

16837{
16838 float result;
16839
16840 float attackPowerBonus;
16841 if (attackPowerOverride)
16842 attackPowerBonus = attackPowerOverride / 14000.0f;
16843 else
16844 attackPowerBonus = getCalculatedAttackPower() / 14000.0f;
16845
16846 if (isInFeralForm())
16847 {
16848 if (getShapeShiftForm() == FORM_CAT)
16849 result = attackPowerBonus * 1000.0f;
16850 else
16851 result = attackPowerBonus * 2500.0f;
16852
16853 return Util::float2int32(result);
16854 }
16855
16856 // no druid shapeShift
16857 uint32_t speed = 2000;
16859 if (item && !m_isDisarmed)
16860 speed = item->getItemProperties()->Delay;
16861
16862 result = attackPowerBonus * speed;
16863 return Util::float2int32(result);
16864}
Here is the call graph for this function:

◆ getManaFromSpell()

uint32_t Player::getManaFromSpell ( )
inline

Definition at line 881 of file Player.hpp.

881{ return m_manaFromSpell; }
uint32_t m_manaFromSpell
Definition Player.hpp:2218
Here is the caller graph for this function:

◆ getManaRegeneration()

float Player::getManaRegeneration ( ) const

Definition at line 1142 of file Player.cpp.

1142{ return playerData()->field_mod_mana_regen; }
Here is the call graph for this function:

◆ getManaRegenerationWhileCasting()

float Player::getManaRegenerationWhileCasting ( ) const

Definition at line 1145 of file Player.cpp.

1145{ return playerData()->field_mod_mana_regen_interrupt; }
Here is the call graph for this function:

◆ getMaxLevel()

uint32_t Player::getMaxLevel ( ) const

Definition at line 1149 of file Player.cpp.

1150{
1151#if VERSION_STRING > Classic
1152 return playerData()->field_max_level;
1153#else
1154 return m_classicMaxLevel;
1155#endif
1156}
uint32_t m_classicMaxLevel
Definition Player.hpp:733
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxPersonalRating()

uint32_t Player::getMaxPersonalRating ( )

Definition at line 13148 of file Player.cpp.

13149{
13150 uint32_t maxRating = 0;
13151
13152 if (m_playerInfo)
13153 {
13154 for (uint8_t index = 0; index < NUM_ARENA_TEAM_TYPES; index++)
13155 {
13156 if (m_arenaTeams[index] != nullptr)
13157 {
13158 if (ArenaTeamMember* arenaTeamMember = m_arenaTeams[index]->getMemberByGuid(m_playerInfo->guid))
13159 {
13160 if (arenaTeamMember->PersonalRating > maxRating)
13161 maxRating = arenaTeamMember->PersonalRating;
13162 }
13163 else
13164 {
13165 sLogger.failure("{}: GetMemberByGuid returned NULL for player guid = {}", __FUNCTION__, m_playerInfo->guid);
13166 }
13167 }
13168 }
13169 }
13170 return maxRating;
13171}
@ NUM_ARENA_TEAM_TYPES
Here is the caller graph for this function:

◆ getMeleeCritPercentage()

float Player::getMeleeCritPercentage ( ) const

Definition at line 1100 of file Player.cpp.

1100{ return playerData()->crit_pct; }
float crit_pct
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMisdirectionTarget()

uint64_t Player::getMisdirectionTarget ( )
inline

Definition at line 2088 of file Player.hpp.

2088{ return m_misdirectionTarget; }
uint64_t m_misdirectionTarget
Definition Player.hpp:2086

◆ getModDamageDoneNegative()

uint32_t Player::getModDamageDoneNegative ( uint16_t  school) const

Definition at line 1205 of file Player.cpp.

1205{ return playerData()->field_mod_damage_done_negative[school]; }
std::array< uint32_t, WOWPLAYER_SPELL_SCHOOL_COUNT > field_mod_damage_done_negative
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModDamageDonePct()

float Player::getModDamageDonePct ( uint8_t  shool) const

Definition at line 1209 of file Player.cpp.

1209{ return playerData()->field_mod_damage_done_pct[shool]; }
std::array< float, WOWPLAYER_SPELL_SCHOOL_COUNT > field_mod_damage_done_pct
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModDamageDonePositive()

uint32_t Player::getModDamageDonePositive ( uint16_t  school) const

Definition at line 1201 of file Player.cpp.

1201{ return playerData()->field_mod_damage_done_positive[school]; }
std::array< uint32_t, WOWPLAYER_SPELL_SCHOOL_COUNT > field_mod_damage_done_positive
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModHealingDone()

uint32_t Player::getModHealingDone ( ) const

Definition at line 1213 of file Player.cpp.

1213{ return playerData()->field_mod_healing_done; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModifiablePetCache()

PetCache * Player::getModifiablePetCache ( uint8_t  petId) const

Definition at line 12285 of file Player.cpp.

12286{
12287 const auto itr = m_cachedPets.find(petId);
12288 if (itr != m_cachedPets.cend())
12289 return itr->second.get();
12290
12291 return nullptr;
12292}
Here is the caller graph for this function:

◆ getModTargetPhysicalResistance()

uint32_t Player::getModTargetPhysicalResistance ( ) const

Definition at line 1221 of file Player.cpp.

1221{ return playerData()->field_mod_target_physical_resistance; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModTargetResistance()

uint32_t Player::getModTargetResistance ( ) const

Definition at line 1217 of file Player.cpp.

1217{ return playerData()->field_mod_target_resistance; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMountSpellId()

uint32_t Player::getMountSpellId ( ) const

Definition at line 1512 of file Player.cpp.

1512{ return m_mountSpellId; }
uint32_t m_mountSpellId
Definition Player.hpp:624
Here is the caller graph for this function:

◆ getMountVehicleId()

uint32_t Player::getMountVehicleId ( ) const

Definition at line 1516 of file Player.cpp.

1516{ return m_mountVehicleId; }
uint32_t m_mountVehicleId
Definition Player.hpp:625

◆ getName()

utf8_string Player::getName ( ) const

Definition at line 2639 of file Player.cpp.

2639{ return m_name; }

◆ getNextLevelXp()

uint32_t Player::getNextLevelXp ( ) const

Definition at line 997 of file Player.cpp.

997{ return playerData()->next_level_xp; }
uint32_t next_level_xp
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNoReagentCost()

uint32_t Player::getNoReagentCost ( uint8_t  index) const

Definition at line 1303 of file Player.cpp.

1303{ return playerData()->no_reagent_cost[index]; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOffHandCritPercentage()

float Player::getOffHandCritPercentage ( ) const

Definition at line 1107 of file Player.cpp.

1107{ return playerData()->offhand_crit_pct; }
Here is the call graph for this function:

◆ getOffHandExpertise()

uint32_t Player::getOffHandExpertise ( ) const

Definition at line 1095 of file Player.cpp.

1095{ return playerData()->offhand_expertise; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPackSlotItemGuid()

uint64_t Player::getPackSlotItemGuid ( uint8_t  slot) const

Definition at line 948 of file Player.cpp.

948{ return playerData()->pack_slot[slot]; }
std::array< uint64_t, WOWPLAYER_PACK_SLOT_COUNT > pack_slot
Here is the call graph for this function:

◆ getParryChance()

float Player::getParryChance ( )

Definition at line 15392 of file Player.cpp.

15393{
15394 float chance = BASE_PARRY_CHANCE;
15395 chance += calcRating(CR_PARRY);
15396 chance += getParryFromSpell();
15397
15398 return std::max(chance, 0.0f); // Make sure we don't have a negative chance
15399}
@ CR_PARRY
#define BASE_PARRY_CHANCE
float getParryFromSpell() const
Definition Unit.hpp:1519
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParryPercentage()

float Player::getParryPercentage ( ) const

Definition at line 1087 of file Player.cpp.

1087{ return playerData()->parry_pct; }
float parry_pct
Here is the call graph for this function:

◆ getPctReputationMod()

int32_t Player::getPctReputationMod ( ) const

Definition at line 11820 of file Player.cpp.

11820{ return m_pctReputationMod; }
int32_t m_pctReputationMod
Definition Player.hpp:1691
Here is the caller graph for this function:

◆ getPendingBattleground()

Battleground * Player::getPendingBattleground ( ) const

Definition at line 8549 of file Player.cpp.

8549{ return m_pendingBattleground; }
Battleground * m_pendingBattleground
Definition Player.hpp:1456

◆ getPetCache()

PetCache const * Player::getPetCache ( uint8_t  petId) const

Definition at line 12276 of file Player.cpp.

12277{
12278 const auto itr = m_cachedPets.find(petId);
12279 if (itr != m_cachedPets.cend())
12280 return itr->second.get();
12281
12282 return nullptr;
12283}
Here is the caller graph for this function:

◆ getPetCachedSlotMap()

std::map< uint8_t, uint8_t > const & Player::getPetCachedSlotMap ( ) const

Definition at line 12299 of file Player.cpp.

12300{
12301 return m_cachedPetSlots;
12302}
Here is the caller graph for this function:

◆ getPetCacheMap()

PetCacheMap const & Player::getPetCacheMap ( ) const

Definition at line 12294 of file Player.cpp.

12295{
12296 return m_cachedPets;
12297}
Here is the caller graph for this function:

◆ getPetCount()

uint8_t Player::getPetCount ( ) const

Definition at line 12323 of file Player.cpp.

12323{ return static_cast<uint8_t>(m_cachedPets.size()); }
Here is the caller graph for this function:

◆ getPetIdFromSlot()

std::optional< uint8_t > Player::getPetIdFromSlot ( uint8_t  slot) const

Definition at line 12335 of file Player.cpp.

12336{
12337 const auto itr = m_cachedPetSlots.find(slot);
12338 if (itr != m_cachedPetSlots.cend())
12339 return itr->second;
12340
12341 return std::nullopt;
12342}
Here is the caller graph for this function:

◆ getPlayedTime()

uint32_t * Player::getPlayedTime ( )

Definition at line 2883 of file Player.cpp.

2883{ return m_playedTime; }
Here is the caller graph for this function:

◆ getPlayerBytes()

uint32_t Player::getPlayerBytes ( ) const

Definition at line 821 of file Player.cpp.

821{ return playerData()->player_bytes.raw; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlayerBytes2()

uint32_t Player::getPlayerBytes2 ( ) const

Definition at line 838 of file Player.cpp.

838{ return playerData()->player_bytes_2.raw; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlayerBytes3()

uint32_t Player::getPlayerBytes3 ( ) const

Definition at line 852 of file Player.cpp.

852{ return playerData()->player_bytes_3.raw; }
Here is the call graph for this function:

◆ getPlayerFieldBytes()

uint32_t Player::getPlayerFieldBytes ( ) const

Definition at line 1226 of file Player.cpp.

Here is the call graph for this function:

◆ getPlayerFieldBytes2()

uint32_t Player::getPlayerFieldBytes2 ( ) const

◆ getPlayerFieldBytesMiscFlag()

uint8_t Player::getPlayerFieldBytesMiscFlag ( ) const

Definition at line 1229 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlayerFlags()

uint32_t Player::getPlayerFlags ( ) const

Definition at line 768 of file Player.cpp.

768{ return playerData()->player_flags; }
uint32_t player_flags
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlayerGender()

uint8_t Player::getPlayerGender ( ) const

Definition at line 855 of file Player.cpp.

Here is the call graph for this function:

◆ getPlayerInfo()

CachedCharacterInfo * Player::getPlayerInfo ( ) const

Definition at line 2885 of file Player.cpp.

2885{ return m_playerInfo; }
Here is the caller graph for this function:

◆ getPlayerOwner() [1/2]

Player const * Player::getPlayerOwner ( ) const
overridevirtual

Reimplemented from Object.

Definition at line 2830 of file Player.cpp.

2831{
2832 if (getCharmedByGuid() != 0)
2834
2835 return nullptr;
2836}
Player * getWorldMapPlayer(const uint64_t &guid) const
Definition Object.cpp:4586
uint64_t getCharmedByGuid() const
Definition Unit.cpp:391
Here is the call graph for this function:

◆ getPlayerOwner() [2/2]

Player * Player::getPlayerOwner ( )
overridevirtual

Reimplemented from Object.

Definition at line 2822 of file Player.cpp.

2823{
2824 if (getCharmedByGuid() != 0)
2826
2827 return nullptr;
2828}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlayerOwnerOrSelf() [1/2]

Player const * Player::getPlayerOwnerOrSelf ( ) const
overridevirtual

Reimplemented from Object.

Definition at line 2846 of file Player.cpp.

2847{
2848 if (auto* const plrOwner = getPlayerOwner())
2849 return plrOwner;
2850
2851 return this;
2852}
Player * getPlayerOwner() override
Definition Player.cpp:2822
Here is the call graph for this function:

◆ getPlayerOwnerOrSelf() [2/2]

Player * Player::getPlayerOwnerOrSelf ( )
overridevirtual

Reimplemented from Object.

Definition at line 2838 of file Player.cpp.

2839{
2840 if (auto* const plrOwner = getPlayerOwner())
2841 return plrOwner;
2842
2843 return this;
2844}
Here is the call graph for this function:

◆ getProfessionSkillLine()

uint32_t Player::getProfessionSkillLine ( uint32_t  index) const

Definition at line 1020 of file Player.cpp.

1020{ return playerData()->profession_skill_line[index]; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPvpRank()

uint8_t Player::getPvpRank ( ) const

Definition at line 861 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getQuestLogByQuestId()

QuestLogEntry * Player::getQuestLogByQuestId ( uint32_t  questId) const

Definition at line 8859 of file Player.cpp.

8860{
8861 for (auto& questlogSlot : m_questlog)
8862 if (questlogSlot != nullptr)
8863 if (questlogSlot->getQuestProperties()->id == questId)
8864 return questlogSlot.get();
8865
8866 return nullptr;
8867}

◆ getQuestLogBySlotId()

QuestLogEntry * Player::getQuestLogBySlotId ( uint32_t  slotId) const

Definition at line 8869 of file Player.cpp.

8870{
8871 if (slotId < MAX_QUEST_LOG_SIZE)
8872 return m_questlog[slotId].get();
8873
8874 return nullptr;
8875}
Here is the caller graph for this function:

◆ getQuestLogEntryForSlot()

uint32_t Player::getQuestLogEntryForSlot ( uint8_t  slot) const

Definition at line 877 of file Player.cpp.

877{ return playerData()->quests[slot].quest_id; }
std::array< WoWPlayer_Quest, WOWPLAYER_QUEST_COUNT > quests
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getQuestLogExpireTimeForSlot()

uint32_t Player::getQuestLogExpireTimeForSlot ( uint8_t  slot) const

Definition at line 916 of file Player.cpp.

916{ return playerData()->quests[slot].expire_time; }
Here is the call graph for this function:

◆ getQuestLogRequiredMobOrGoForSlot()

uint32_t Player::getQuestLogRequiredMobOrGoForSlot ( uint8_t  slot) const

Definition at line 901 of file Player.cpp.

901{ return playerData()->quests[slot].required_mob_or_go; }
Here is the call graph for this function:

◆ getQuestLogStateForSlot()

uint32_t Player::getQuestLogStateForSlot ( uint8_t  slot) const

Definition at line 884 of file Player.cpp.

885{
886 //\todo: get last 1*8 bits as state
887 return playerData()->quests[slot].required_count_state;
888}
Here is the call graph for this function:

◆ getQuestSharerByDbId()

uint32_t Player::getQuestSharerByDbId ( ) const

Definition at line 8922 of file Player.cpp.

8922{ return m_questSharer; }
uint32_t m_questSharer
Definition Player.hpp:1528
Here is the caller graph for this function:

◆ getQueuedBgInstanceId()

uint32_t Player::getQueuedBgInstanceId ( ) const

Definition at line 8556 of file Player.cpp.

8556{ return m_queuedBgInstanceId; }
uint32_t m_queuedBgInstanceId
Definition Player.hpp:1459
Here is the caller graph for this function:

◆ getRaidDifficulty()

uint8_t Player::getRaidDifficulty ( )

Definition at line 7251 of file Player.cpp.

7252{
7253 return m_raidDifficulty;
7254}
Here is the caller graph for this function:

◆ getRangedCritPercentage()

float Player::getRangedCritPercentage ( ) const

Definition at line 1103 of file Player.cpp.

1103{ return playerData()->ranged_crit_pct; }
float ranged_crit_pct
Here is the call graph for this function:

◆ getReputationRankFromStanding()

Standing Player::getReputationRankFromStanding ( int32_t  value)
static

Definition at line 11524 of file Player.cpp.

11525{
11526 if (value >= 42000)
11527 return STANDING_EXALTED;
11528 if (value >= 21000)
11529 return STANDING_REVERED;
11530 if (value >= 9000)
11531 return STANDING_HONORED;
11532 if (value >= 3000)
11533 return STANDING_FRIENDLY;
11534 if (value >= 0)
11535 return STANDING_NEUTRAL;
11536 if (value > -3000)
11537 return STANDING_UNFRIENDLY;
11538 if (value > -6000)
11539 return STANDING_HOSTILE;
11540
11541 return STANDING_HATED;
11542}
@ STANDING_HONORED
@ STANDING_HATED
@ STANDING_REVERED
@ STANDING_HOSTILE
@ STANDING_FRIENDLY
@ STANDING_NEUTRAL
@ STANDING_EXALTED
@ STANDING_UNFRIENDLY
Here is the caller graph for this function:

◆ getResistanceBuffModNegative()

uint32_t Player::getResistanceBuffModNegative ( uint8_t  type) const

Definition at line 1197 of file Player.cpp.

std::array< uint32_t, WOWPLAYER_SPELL_SCHOOL_COUNT > resistance_buff_mod_negative
Here is the call graph for this function:

◆ getResistanceBuffModPositive()

uint32_t Player::getResistanceBuffModPositive ( uint8_t  type) const

Definition at line 1194 of file Player.cpp.

std::array< uint32_t, WOWPLAYER_SPELL_SCHOOL_COUNT > resistance_buff_mod_positive
Here is the call graph for this function:

◆ getResistMCrit()

float Player::getResistMCrit ( )
inline

Definition at line 885 of file Player.hpp.

885{ return m_resistCritical[0]; }
float m_resistCritical[2]
Definition Player.hpp:891

◆ getResistRCrit()

float Player::getResistRCrit ( )
inline

Definition at line 888 of file Player.hpp.

888{ return m_resistCritical[1]; }
Here is the caller graph for this function:

◆ getRestState()

uint8_t Player::getRestState ( ) const

Definition at line 847 of file Player.cpp.

Here is the call graph for this function:

◆ getRestStateXp()

uint32_t Player::getRestStateXp ( ) const

Definition at line 1172 of file Player.cpp.

1172{ return playerData()->rest_state_xp; }
uint32_t rest_state_xp
Here is the call graph for this function:

◆ getRuneRegen()

float Player::getRuneRegen ( uint8_t  rune) const

Definition at line 1168 of file Player.cpp.

1168{ return playerData()->rune_regen[rune]; }
Here is the call graph for this function:

◆ getSelectedGo()

GameObject * Player::getSelectedGo ( ) const

Definition at line 2344 of file Player.cpp.

2345{
2346 if (m_GMSelectedGO)
2347 return getWorldMap()->getGameObject(static_cast<uint32_t>(m_GMSelectedGO));
2348
2349 return nullptr;
2350}
uint64_t m_GMSelectedGO
Definition Player.hpp:1104
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSelfResurrectSpell()

uint32_t Player::getSelfResurrectSpell ( ) const

Definition at line 1135 of file Player.cpp.

uint32_t self_resurrection_spell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getServersideDrunkValue()

uint16_t Player::getServersideDrunkValue ( ) const

Definition at line 11827 of file Player.cpp.

11827{ return m_serversideDrunkValue; }
uint16_t m_serversideDrunkValue
Definition Player.hpp:1706
Here is the caller graph for this function:

◆ getSession()

WorldSession * Player::getSession ( ) const

Definition at line 3131 of file Player.cpp.

3131{ return m_session; }

◆ getShapeshiftSpells()

SpellSet const & Player::getShapeshiftSpells ( ) const

Definition at line 4080 of file Player.cpp.

4081{
4082 return m_shapeshiftSpells;
4083}
Here is the caller graph for this function:

◆ getShieldBlock()

uint32_t Player::getShieldBlock ( ) const

Definition at line 1113 of file Player.cpp.

1113{ return playerData()->shield_block; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getShieldBlockCritPercentage()

float Player::getShieldBlockCritPercentage ( ) const

Definition at line 1118 of file Player.cpp.

1118{ return playerData()->shield_block_crit_pct; }
Here is the call graph for this function:

◆ getSkillInfoBonusPermanent()

uint16_t Player::getSkillInfoBonusPermanent ( uint32_t  index,
uint8_t  offset 
) const

Definition at line 1019 of file Player.cpp.

1019{ return *(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_talent[index]) + offset); }
Here is the call graph for this function:

◆ getSkillInfoBonusTemporary()

uint16_t Player::getSkillInfoBonusTemporary ( uint32_t  index,
uint8_t  offset 
) const

Definition at line 1018 of file Player.cpp.

1018{ return *(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_mod[index]) + offset); }
Here is the call graph for this function:

◆ getSkillInfoCurrentValue()

uint16_t Player::getSkillInfoCurrentValue ( uint32_t  index,
uint8_t  offset 
) const

Definition at line 1016 of file Player.cpp.

1016{ return *(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_rank[index]) + offset); }
Here is the call graph for this function:

◆ getSkillInfoId()

uint16_t Player::getSkillInfoId ( uint32_t  index,
uint8_t  offset 
) const

Definition at line 1014 of file Player.cpp.

1014{ return *(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_line[index]) + offset); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSkillInfoMaxValue()

uint16_t Player::getSkillInfoMaxValue ( uint32_t  index,
uint8_t  offset 
) const

Definition at line 1017 of file Player.cpp.

1017{ return *(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_max_rank[index]) + offset); }
Here is the call graph for this function:

◆ getSkillInfoStep()

uint16_t Player::getSkillInfoStep ( uint32_t  index,
uint8_t  offset 
) const

Definition at line 1015 of file Player.cpp.

1015{ return *(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_step[index]) + offset); }
Here is the call graph for this function:

◆ getSkillLineCurrent()

uint16_t Player::getSkillLineCurrent ( uint16_t  skillLine,
bool  includeBonus = true 
) const

Definition at line 4928 of file Player.cpp.

4929{
4930 if (skillLine == 0)
4931 return 0;
4932
4933 const auto itr = m_skills.find(skillLine);
4934 if (itr == m_skills.end())
4935 return 0;
4936
4937 if (!includeBonus)
4938 return itr->second.CurrentValue;
4939
4940 const auto result = static_cast<int32_t>(itr->second.CurrentValue) + itr->second.PermanentBonusValue + itr->second.TemporaryBonusValue;
4941 return result < 0 ? 0U : static_cast<uint16_t>(result);
4942}
Here is the caller graph for this function:

◆ getSkillLineMax()

uint16_t Player::getSkillLineMax ( uint16_t  skillLine) const

Definition at line 4944 of file Player.cpp.

4945{
4946 if (skillLine == 0)
4947 return 0;
4948
4949 const auto itr = m_skills.find(skillLine);
4950 if (itr == m_skills.end())
4951 return 0;
4952
4953 return itr->second.MaximumValue;
4954}
Here is the caller graph for this function:

◆ getSkillUpChance()

float Player::getSkillUpChance ( uint16_t  id)

Definition at line 5191 of file Player.cpp.

5192{
5193 SkillMap::iterator itr = m_skills.find(id);
5194 if (itr == m_skills.end())
5195 return 0.0f;
5196
5197 return itr->second.GetSkillUpChance();
5198}
Here is the caller graph for this function:

◆ getSkinColor()

uint8_t Player::getSkinColor ( ) const

Definition at line 824 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSpellCritFromSpell()

float Player::getSpellCritFromSpell ( )
inline

Definition at line 2035 of file Player.hpp.

2035{ return m_spellCritFromSpell; }
float m_spellCritFromSpell
Definition Player.hpp:2214
Here is the caller graph for this function:

◆ getSpellCritPercentage()

float Player::getSpellCritPercentage ( uint8_t  school) const

Definition at line 1110 of file Player.cpp.

1110{ return playerData()->spell_crit_pct[school]; }
Here is the call graph for this function:

◆ getSpellSet()

SpellSet const & Player::getSpellSet ( ) const

Definition at line 3960 of file Player.cpp.

3961{
3962 return m_spellSet;
3963}
Here is the caller graph for this function:

◆ getStableSlotCount()

uint8_t Player::getStableSlotCount ( ) const

Definition at line 12663 of file Player.cpp.

12663{ return m_stableSlotCount; }
Here is the caller graph for this function:

◆ getSubGroupSlot()

int8_t Player::getSubGroupSlot ( ) const

Definition at line 7898 of file Player.cpp.

Here is the caller graph for this function:

◆ getSummonedObject()

Object * Player::getSummonedObject ( ) const

Definition at line 12704 of file Player.cpp.

12704{ return m_summonedObject; }
Object * m_summonedObject
Definition Player.hpp:1811
Here is the caller graph for this function:

◆ getSummonSpells()

std::set< uint32_t > * Player::getSummonSpells ( uint32_t  spellId)

Definition at line 14008 of file Player.cpp.

14009{
14010 std::map<uint32_t, std::set<uint32_t> >::iterator itr = m_summonSpells.find(entry);
14011 if (itr != m_summonSpells.end())
14012 return &itr->second;
14013
14014 return nullptr;
14015}

◆ getTalentPointsFromQuests()

uint32_t Player::getTalentPointsFromQuests ( ) const

Definition at line 6142 of file Player.cpp.

6143{
6145}
uint32_t m_talentPointsFromQuests
Definition Player.hpp:1011
Here is the caller graph for this function:

◆ getTalentResetsCount()

uint32_t Player::getTalentResetsCount ( ) const

Definition at line 6318 of file Player.cpp.

6318{ return m_talentResetsCount; }
uint32_t m_talentResetsCount
Definition Player.hpp:1012
Here is the caller graph for this function:

◆ getTaxiData()

TaxiPath * Player::getTaxiData ( ) const
inline

Definition at line 1626 of file Player.hpp.

1626{ return m_taxi.get(); }
Here is the caller graph for this function:

◆ getTeam()

PlayerTeam Player::getTeam ( ) const

Definition at line 2774 of file Player.cpp.

◆ getTeleportState()

uint32_t Player::getTeleportState ( ) const

Definition at line 1893 of file Player.cpp.

1893{ return m_teleportState; }
uint32_t m_teleportState
Definition Player.hpp:631
Here is the caller graph for this function:

◆ getTrackCreature()

uint32_t Player::getTrackCreature ( ) const

Definition at line 1075 of file Player.cpp.

1075{ return playerData()->track_creatures; }
uint32_t track_creatures
Here is the call graph for this function:

◆ getTrackResource()

uint32_t Player::getTrackResource ( ) const

Definition at line 1078 of file Player.cpp.

1078{ return playerData()->track_resources; }
uint32_t track_resources
Here is the call graph for this function:

◆ getTradeData()

TradeData * Player::getTradeData ( ) const

Definition at line 6506 of file Player.cpp.

6507{
6508 return m_TradeData.get();
6509}
Here is the caller graph for this function:

◆ getTradeTarget()

Player * Player::getTradeTarget ( ) const

Definition at line 6501 of file Player.cpp.

6502{
6503 return m_TradeData != nullptr ? m_TradeData->getTradeTarget() : nullptr;
6504}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTransferStatus()

uint8_t Player::getTransferStatus ( ) const

Definition at line 1890 of file Player.cpp.

1890{ return m_transferStatus; }
uint8_t m_transferStatus
Definition Player.hpp:630
Here is the caller graph for this function:

◆ getTutorialValueById()

uint32_t Player::getTutorialValueById ( uint8_t  id)

Definition at line 6334 of file Player.cpp.

6335{
6336 if (id < 8)
6337 return m_tutorials[id];
6338 return 0;
6339}
uint32_t m_tutorials[8]
Definition Player.hpp:1025
Here is the caller graph for this function:

◆ getUnitOwner() [1/2]

Unit const * Player::getUnitOwner ( ) const
overridevirtual

Reimplemented from Object.

Definition at line 2798 of file Player.cpp.

2799{
2800 if (getCharmedByGuid() != 0)
2802
2803 return nullptr;
2804}
Unit * getWorldMapUnit(const uint64_t &guid) const
Definition Object.cpp:4578
Here is the call graph for this function:

◆ getUnitOwner() [2/2]

Unit * Player::getUnitOwner ( )
overridevirtual

Reimplemented from Object.

Definition at line 2790 of file Player.cpp.

2791{
2792 if (getCharmedByGuid() != 0)
2794
2795 return nullptr;
2796}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUnitOwnerOrSelf() [1/2]

Unit const * Player::getUnitOwnerOrSelf ( ) const
overridevirtual

Reimplemented from Object.

Definition at line 2814 of file Player.cpp.

2815{
2816 if (auto* const unitOwner = getUnitOwner())
2817 return unitOwner;
2818
2819 return this;
2820}
Unit * getUnitOwner() override
Definition Player.cpp:2790
Here is the call graph for this function:

◆ getUnitOwnerOrSelf() [2/2]

Unit * Player::getUnitOwnerOrSelf ( )
overridevirtual

Reimplemented from Object.

Definition at line 2806 of file Player.cpp.

2807{
2808 if (auto* const unitOwner = getUnitOwner())
2809 return unitOwner;
2810
2811 return this;
2812}
Here is the call graph for this function:

◆ getUpdateMgr()

UpdateManager & Player::getUpdateMgr ( )

Definition at line 3554 of file Player.cpp.

3554{ return m_updateMgr; }
Here is the caller graph for this function:

◆ getVanityPetSlotItemGuid()

uint64_t Player::getVanityPetSlotItemGuid ( uint8_t  slot) const

Definition at line 966 of file Player.cpp.

966{ return playerData()->vanity_pet_slot[slot]; }
Here is the call graph for this function:

◆ getVendorBuybackSlot()

uint64_t Player::getVendorBuybackSlot ( uint8_t  slot) const

Definition at line 957 of file Player.cpp.

957{ return playerData()->vendor_buy_back_slot[slot]; }
std::array< uint64_t, WOWPLAYER_BUY_BACK_COUNT > vendor_buy_back_slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVisibleItemEnchantment()

uint32_t Player::getVisibleItemEnchantment ( uint32_t  slot,
uint8_t  pos 
) const

Definition at line 940 of file Player.cpp.

940{ return playerData()->visible_items[slot].enchantment[pos]; }
std::array< WoWPlayer_VisibleItem, WOWPLAYER_VISIBLE_ITEM_COUNT > visible_items
Here is the call graph for this function:

◆ getVisibleItemEntry()

uint32_t Player::getVisibleItemEntry ( uint32_t  slot) const

Definition at line 921 of file Player.cpp.

921{ return playerData()->visible_items[slot].entry; }
Here is the call graph for this function:

◆ getWatchedFaction()

uint32_t Player::getWatchedFaction ( ) const

Definition at line 1138 of file Player.cpp.

uint32_t field_watched_faction_idx
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWeaponProficiency()

uint32_t Player::getWeaponProficiency ( ) const

Definition at line 5238 of file Player.cpp.

5239{
5240 return weaponProficiency;
5241}
Here is the caller graph for this function:

◆ getXp()

uint32_t Player::getXp ( ) const

Definition at line 993 of file Player.cpp.

993{ return playerData()->xp; }
uint32_t xp
Here is the call graph for this function:
Here is the caller graph for this function:

◆ giveXp()

void Player::giveXp ( uint32_t  xp,
const uint64_t guid,
bool  allowBonus 
)

Definition at line 12133 of file Player.cpp.

12134{
12135 if (xp < 1)
12136 return;
12137
12138#if VERSION_STRING >= Cata
12139 //this is new since 403. As we gain XP we also gain XP with our guild
12141 {
12142 uint32_t guild_share = xp / 100;
12143
12144 if (Guild* guild = sGuildMgr.getGuildById(m_playerInfo->m_guild))
12145 guild->giveXP(guild_share, this);
12146 }
12147#endif
12148
12149 if (!m_isXpGainAllowed)
12150 return;
12151
12152 if (getLevel() >= getMaxLevel())
12153 return;
12154
12155 uint32_t restXp = xp;
12156
12157 if (m_restState == RESTSTATE_RESTED && allowBonus)
12158 {
12159 restXp = subtractRestXp(xp);
12160 xp += restXp;
12161 }
12162
12164
12165 sendLogXpGainPacket(guid, xp, restXp, guid == 0 ? true : false);
12166
12167 int32_t newXp = getXp() + xp;
12168 int32_t nextLevelXp = getNextLevelXp();
12169 uint32_t level = getLevel();
12170 bool levelup = false;
12171
12172 while (newXp >= nextLevelXp && newXp > 0)
12173 {
12174 ++level;
12175 if (sObjectMgr.getLevelInfo(getRace(), getClass(), level))
12176 {
12177 newXp -= nextLevelXp;
12178 nextLevelXp = sMySQLStore.getPlayerXPForLevel(level);
12179 levelup = true;
12180 if (level >= getMaxLevel())
12181 break;
12182 }
12183 else
12184 {
12185 return;
12186 }
12187 }
12188
12189 if (level > getMaxLevel())
12190 level = getMaxLevel();
12191
12192 if (levelup)
12193 applyLevelInfo(level);
12194
12195 setXp(newXp);
12196}
void setXp(uint32_t xp)
Definition Player.cpp:994
uint32_t subtractRestXp(uint32_t amount)
Definition Player.cpp:12206
void applyLevelInfo(uint32_t newLevel)
Definition Player.cpp:2669
void sendLogXpGainPacket(uint64_t guid, uint32_t normalXp, uint32_t restedXp, bool type)
Definition Player.cpp:12198
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAuraInterruptForMovementFlags()

void Player::handleAuraInterruptForMovementFlags ( MovementInfo const movement_info)

Definition at line 1519 of file Player.cpp.

1520{
1521 uint32_t auraInterruptFlags = 0;
1522 if (movementInfo.hasMovementFlag(MOVEFLAG_MOTION_MASK))
1523 auraInterruptFlags |= AURA_INTERRUPT_ON_MOVEMENT;
1524
1525 if (!(movementInfo.hasMovementFlag(MOVEFLAG_SWIMMING)) || movementInfo.hasMovementFlag(MOVEFLAG_FALLING))
1526 auraInterruptFlags |= AURA_INTERRUPT_ON_LEAVE_WATER;
1527
1528 if (movementInfo.hasMovementFlag(MOVEFLAG_SWIMMING))
1529 auraInterruptFlags |= AURA_INTERRUPT_ON_ENTER_WATER;
1530
1531 if ((movementInfo.hasMovementFlag(MOVEFLAG_TURNING_MASK)) || m_isTurning)
1532 auraInterruptFlags |= AURA_INTERRUPT_ON_TURNING;
1533
1534 removeAllAurasByAuraInterruptFlag(auraInterruptFlags);
1535}
@ AURA_INTERRUPT_ON_ENTER_WATER
@ AURA_INTERRUPT_ON_MOVEMENT
@ AURA_INTERRUPT_ON_TURNING
@ AURA_INTERRUPT_ON_LEAVE_WATER
@ MOVEFLAG_TURNING_MASK
@ MOVEFLAG_MOTION_MASK
@ MOVEFLAG_FALLING
@ MOVEFLAG_SWIMMING
bool m_isTurning
Definition Player.hpp:621
void removeAllAurasByAuraInterruptFlag(uint32_t auraInterruptFlag, uint32_t skipSpellId=0)
Definition Unit.cpp:5290
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBreathing()

void Player::handleBreathing ( MovementInfo const movement_info,
WorldSession session 
)

Definition at line 1554 of file Player.cpp.

1555{
1557 {
1559 m_underwaterState &= ~UNDERWATERSTATE_SWIMMING;
1560
1562 {
1563 m_underwaterState &= ~UNDERWATERSTATE_UNDERWATER;
1565 }
1566
1567 if (session->m_bIsWLevelSet)
1568 {
1569 if (movementInfo.getPosition()->z + m_noseLevel > session->m_wLevel)
1570 {
1572 session->m_bIsWLevelSet = false;
1573 }
1574 }
1575
1576 return;
1577 }
1578
1579 if (movementInfo.hasMovementFlag(MOVEFLAG_SWIMMING) && !(m_underwaterState & UNDERWATERSTATE_SWIMMING))
1580 {
1582
1583 if (!session->m_bIsWLevelSet)
1584 {
1585 session->m_wLevel = movementInfo.getPosition()->z + m_noseLevel * 0.95f;
1586 session->m_bIsWLevelSet = true;
1587 }
1588
1590 }
1591
1592#if VERSION_STRING <= WotLK
1593 if (!movementInfo.hasMovementFlag(MOVEFLAG_SWIMMING) && movementInfo.flags != MOVEFLAG_MOVE_STOP && m_underwaterState & UNDERWATERSTATE_SWIMMING)
1594#else
1595 if (!movementInfo.hasMovementFlag(MOVEFLAG_SWIMMING) && movementInfo.flags != MOVEFLAG_NONE && m_underwaterState & UNDERWATERSTATE_SWIMMING)
1596#endif
1597 {
1598 if (movementInfo.getPosition()->z + m_noseLevel > session->m_wLevel)
1599 {
1601 session->m_bIsWLevelSet = false;
1602
1603 m_underwaterState &= ~UNDERWATERSTATE_SWIMMING;
1604 }
1605 }
1606
1608 {
1609 if (movementInfo.getPosition()->z + m_noseLevel < session->m_wLevel)
1610 {
1613 }
1614 }
1615
1617 {
1618 if (movementInfo.getPosition()->z + m_noseLevel > session->m_wLevel)
1619 {
1620 m_underwaterState &= ~UNDERWATERSTATE_UNDERWATER;
1622 }
1623 }
1624
1626 {
1627 if (movementInfo.getPosition()->z + m_noseLevel > session->m_wLevel)
1628 {
1629 m_underwaterState &= ~UNDERWATERSTATE_UNDERWATER;
1631 }
1632 }
1633}
@ MOVEFLAG_MOVE_STOP
@ MOVEFLAG_NONE
@ UNDERWATERSTATE_SWIMMING
@ UNDERWATERSTATE_UNDERWATER
uint32_t m_underwaterMaxTime
Definition Player.hpp:584
bool m_isWaterBreathingEnabled
Definition Player.hpp:582
void sendMirrorTimer(MirrorTimerTypes mirrorType, uint32_t max, uint32_t current, int32_t regen)
Definition Player.cpp:16157
float m_noseLevel
Definition Player.hpp:627
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDuelCountdown()

void Player::handleDuelCountdown ( )

Definition at line 12099 of file Player.cpp.

12100{
12101 if (m_duelPlayer == nullptr)
12102 return;
12103
12104 m_duelCountdownTimer -= 1000;
12105
12106 if (static_cast<int32_t>(m_duelCountdownTimer) < 0)
12108
12109 if (m_duelCountdownTimer == 0)
12110 {
12113
12115 setDuelTeam(2);
12116
12119
12122 }
12123}
@ DUEL_STATE_STARTED
void setDuelState(uint8_t state)
Definition Player.cpp:12128
void testDuelBoundary()
Definition Player.cpp:11914
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleKnockback()

void Player::handleKnockback ( Object caster,
float  horizontal,
float  vertical 
)
overridevirtual

Reimplemented from Unit.

Definition at line 1724 of file Player.cpp.

1725{
1726 if (object == nullptr)
1727 object = this;
1728
1729 float angle = calcRadAngle(object->GetPositionX(), object->GetPositionY(), GetPositionX(), GetPositionY());
1730 if (object == this)
1731 angle = static_cast<float>(M_PI + GetOrientation());
1732
1733 float sin = sinf(angle);
1734 float cos = cosf(angle);
1735
1736 getSession()->SendPacket(SmsgMoveKnockBack(GetNewGUID(), Util::getMSTime(), cos, sin, horizontal, -vertical).serialise().get());
1737
1738 m_blinked = true;
1739 speedCheatDelay(10000);
1740}
#define M_PI
float calcRadAngle(float Position1X, float Position1Y, float Position2X, float Position2Y)
Definition Object.cpp:3700
bool m_blinked
Definition Player.hpp:2174
void speedCheatDelay(uint32_t delay)
Definition Player.cpp:9369
Here is the call graph for this function:

◆ handleSobering()

void Player::handleSobering ( )

Definition at line 11865 of file Player.cpp.

11866{
11867 m_drunkTimer = 0;
11868
11869 setDrunkValue((m_serversideDrunkValue <= 256) ? 0U : static_cast<uint8_t>(m_serversideDrunkValue - 256));
11870}
void setDrunkValue(uint8_t value)
Definition Player.cpp:859
uint32_t m_drunkTimer
Definition Player.hpp:1705
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSpellLoot()

void Player::handleSpellLoot ( uint32_t  itemId)

Definition at line 13255 of file Player.cpp.

13256{
13257 Loot loot1;
13258 sLootMgr.fillItemLoot(this, &loot1, itemId, 0);
13259
13260 for (const auto& item : loot1.items)
13261 {
13262 uint32_t looteditemid = item.itemproto->ItemId;
13263 uint32_t count = item.count;
13264
13265 getItemInterface()->AddItemById(looteditemid, count, 0);
13266 }
13267}
#define sLootMgr
Definition LootMgr.hpp:106
bool AddItemById(uint32_t itemid, uint32_t count, int32_t randomprop)
Definition Loot.hpp:35
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasAnyQuestInQuestSlot()

bool Player::hasAnyQuestInQuestSlot ( ) const

Definition at line 8833 of file Player.cpp.

8834{
8835 for (auto& questlogSlot : m_questlog)
8836 if (questlogSlot != nullptr)
8837 return true;
8838
8839 return false;
8840}
#define true
Definition StormPort.h:32
Here is the caller graph for this function:

◆ hasAreaExplored()

bool Player::hasAreaExplored ( WDB::Structures::AreaTableEntry const )

Definition at line 2165 of file Player.cpp.

2166{
2167 if (areaTableEntry)
2168 {
2169 uint16_t offset = static_cast<uint16_t>(areaTableEntry->explore_flag / 32);
2170
2171 uint32_t val = (uint32_t)(1 << (areaTableEntry->explore_flag % 32));
2172 uint32_t currFields = getExploredZone(offset);
2173
2174 return (currFields & val) != 0;
2175 }
2176
2177 return false;
2178}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasBgFlag()

bool Player::hasBgFlag ( ) const

Definition at line 8577 of file Player.cpp.

8577{ return m_bgHasFlag; }
bool m_bgHasFlag
Definition Player.hpp:1466
Here is the caller graph for this function:

◆ hasDeletedSpell()

bool Player::hasDeletedSpell ( uint32_t  spellId) const

Definition at line 3930 of file Player.cpp.

3931{
3932 return m_deletedSpellSet.find(spellId) != m_deletedSpellSet.cend();
3933}
Here is the caller graph for this function:

◆ hasEnoughCoinage()

bool Player::hasEnoughCoinage ( uint64_t  coinage) const

Definition at line 1186 of file Player.cpp.

1186{ return getCoinage() >= coinage; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasItem()

bool Player::hasItem ( uint32_t  itemId,
uint32_t  amount = 1,
bool  checkBankAlso = false 
) const

Definition at line 6641 of file Player.cpp.

6642{
6643 return getItemInterface()->GetItemCount(itemId, checkBankAlso) >= amount;
6644}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasOffHandWeapon()

bool Player::hasOffHandWeapon ( ) const

Definition at line 6629 of file Player.cpp.

6630{
6631 if (!canDualWield())
6632 return false;
6633
6634 const auto offHandItem = getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
6635 if (offHandItem == nullptr)
6636 return false;
6637
6638 return offHandItem->isWeapon();
6639}
bool isWeapon() const
Definition Item.hpp:220
bool canDualWield() const
Definition Unit.cpp:3537
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasOverlayUncovered()

bool Player::hasOverlayUncovered ( uint32_t  overlayId)

Definition at line 2180 of file Player.cpp.

2181{
2182 if (auto overlay = sWorldMapOverlayStore.lookupEntry(overlayId))
2183 {
2184 if (overlay->areaID && hasAreaExplored(AreaStorage::GetAreaById(overlay->areaID)))
2185 return true;
2186
2187 if (overlay->areaID_2 && hasAreaExplored(AreaStorage::GetAreaById(overlay->areaID_2)))
2188 return true;
2189
2190 if (overlay->areaID_3 && hasAreaExplored(AreaStorage::GetAreaById(overlay->areaID_3)))
2191 return true;
2192
2193 if (overlay->areaID_4 && hasAreaExplored(AreaStorage::GetAreaById(overlay->areaID_4)))
2194 return true;
2195 }
2196
2197 return false;
2198}
SERVER_DECL WDB::WDBContainer< WDB::Structures::WorldMapOverlayEntry > sWorldMapOverlayStore
bool hasAreaExplored(WDB::Structures::AreaTableEntry const *)
Definition Player.cpp:2165
Here is the call graph for this function:

◆ hasPendingBind()

bool Player::hasPendingBind ( ) const
inline

Definition at line 2138 of file Player.hpp.

2138{ return m_pendingBindId > 0; }
Here is the caller graph for this function:

◆ hasPetInSlot()

bool Player::hasPetInSlot ( uint8_t  slot) const

Definition at line 12344 of file Player.cpp.

12345{
12346 return m_cachedPetSlots.contains(slot);
12347}
Here is the caller graph for this function:

◆ hasPlayerFlags()

bool Player::hasPlayerFlags ( uint32_t  flags) const

Definition at line 786 of file Player.cpp.

786{ return (getPlayerFlags() & flags) != 0; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasPvPTitle()

bool Player::hasPvPTitle ( RankTitles  title)

Definition at line 8515 of file Player.cpp.

8516{
8517#if VERSION_STRING > Classic
8518 const auto index = static_cast<uint8_t>(title / 32);
8519
8520 return (getKnownTitles(index) & 1ULL << static_cast<uint64_t>((title % 32))) != 0;
8521#else
8522 return false;
8523#endif
8524}
Here is the caller graph for this function:

◆ hasQuestFinished()

bool Player::hasQuestFinished ( uint32_t  questId) const

Definition at line 8935 of file Player.cpp.

8936{
8937 return m_finishedQuests.find(questId) != m_finishedQuests.cend();
8938}
Here is the caller graph for this function:

◆ hasQuestForItem()

bool Player::hasQuestForItem ( uint32_t  itemId) const

Definition at line 8951 of file Player.cpp.

8952{
8953 for (const auto& questLogEntry : m_questlog)
8954 {
8955 if (questLogEntry != nullptr)
8956 {
8957 QuestProperties const* questProperties = questLogEntry->getQuestProperties();
8958
8959 // Check the item_quest_association table for an entry related to this item
8960 if (const auto* tempList = sQuestMgr.GetQuestAssociationListForItemId(itemId))
8961 {
8962 for (auto questAssiciation = tempList->cbegin(); questAssiciation != tempList->cend(); ++questAssiciation)
8963 if ((*questAssiciation)->qst == questProperties && (getItemInterface()->GetItemCount(itemId) < (*questAssiciation)->item_count))
8964 return true;
8965 }
8966
8967 // No item_quest association found, check the quest requirements
8968 if (!questProperties->count_required_item)
8969 continue;
8970
8971 for (uint8_t j = 0; j < MAX_REQUIRED_QUEST_ITEM; ++j)
8972 if (questProperties->required_item[j] == itemId && getItemInterface()->GetItemCount(itemId) < questProperties->required_itemcount[j])
8973 return true;
8974 }
8975 }
8976 return false;
8977}
#define MAX_REQUIRED_QUEST_ITEM
uint32_t required_itemcount[MAX_REQUIRED_QUEST_ITEM]
uint32_t required_item[MAX_REQUIRED_QUEST_ITEM]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasQuestInFinishedDailies()

bool Player::hasQuestInFinishedDailies ( uint32_t  questId) const

Definition at line 8887 of file Player.cpp.

8888{
8889 std::lock_guard<std::mutex> lock(m_mutextDailies);
8890 return m_finishedDailies.find(questId) != m_finishedDailies.end();
8891}
Here is the caller graph for this function:

◆ hasQuestInQuestLog()

bool Player::hasQuestInQuestLog ( uint32_t  questId) const

Definition at line 8842 of file Player.cpp.

8843{
8844 if (getQuestLogByQuestId(questId))
8845 return true;
8846
8847 return false;
8848}
Here is the call graph for this function:

◆ hasQuestMob()

bool Player::hasQuestMob ( uint32_t  entry)

Definition at line 9000 of file Player.cpp.

9001{
9002 if (!quest_mobs.empty() && quest_mobs.find(entry) != quest_mobs.end())
9003 return true;
9004
9005 return false;
9006}
Here is the caller graph for this function:

◆ hasQuestSpell()

bool Player::hasQuestSpell ( uint32_t  spellId)

Definition at line 8982 of file Player.cpp.

8983{
8984 if (!quest_spells.empty() && quest_spells.find(spellId) != quest_spells.end())
8985 return true;
8986
8987 return false;
8988}
Here is the caller graph for this function:

◆ hasQueuedBgInstanceId()

bool Player::hasQueuedBgInstanceId ( ) const

Definition at line 8555 of file Player.cpp.

8555{ return m_queuedBgInstanceId != 0; }
Here is the caller graph for this function:

◆ hasSkillLine()

bool Player::hasSkillLine ( uint16_t  skillLine,
bool  strict = false 
) const

Definition at line 4912 of file Player.cpp.

4913{
4914 if (skillLine == 0)
4915 return false;
4916
4917 const auto itr = m_skills.find(skillLine);
4918 if (itr == m_skills.end())
4919 return false;
4920
4921 // Skip initialized only skills
4922 if (itr->second.CurrentValue == 0 && !strict)
4923 return false;
4924
4925 return true;
4926}
Here is the caller graph for this function:

◆ hasSpell()

bool Player::hasSpell ( uint32_t  spellId) const

Definition at line 3925 of file Player.cpp.

3926{
3927 return m_spellSet.find(spellId) != m_spellSet.cend();
3928}
Here is the caller graph for this function:

◆ hasSpellGlobalCooldown()

bool Player::hasSpellGlobalCooldown ( SpellInfo const spellInfo)

Definition at line 4330 of file Player.cpp.

4331{
4332 const auto curTime = Util::getMSTime();
4333
4334 // Check for cooldown cheat as well
4335 if (spellInfo->getStartRecoveryTime() > 0 && m_globalCooldown > 0 && !m_cheats.hasCooldownCheat)
4336 {
4337 if (curTime < m_globalCooldown)
4338 return true;
4339
4340 // Global cooldown has expired
4341 m_globalCooldown = 0;
4342 }
4343
4344 return false;
4345}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasSpellOnCooldown()

bool Player::hasSpellOnCooldown ( SpellInfo const spellInfo)

Definition at line 4298 of file Player.cpp.

4299{
4300 const auto curTime = Util::getMSTime();
4301
4302 // Check category cooldown
4303 if (spellInfo->getCategory() > 0)
4304 {
4305 const auto itr = m_cooldownMap[COOLDOWN_TYPE_CATEGORY].find(spellInfo->getCategory());
4306 if (itr != m_cooldownMap[COOLDOWN_TYPE_CATEGORY].end())
4307 {
4308 if (curTime < itr->second.ExpireTime)
4309 return true;
4310
4311 // Cooldown has expired
4313 }
4314 }
4315
4316 // Check spell cooldown
4317 const auto itr = m_cooldownMap[COOLDOWN_TYPE_SPELL].find(spellInfo->getId());
4318 if (itr != m_cooldownMap[COOLDOWN_TYPE_SPELL].end())
4319 {
4320 if (curTime < itr->second.ExpireTime)
4321 return true;
4322
4323 // Cooldown has expired
4325 }
4326
4327 return false;
4328}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasSpellWithAuraNameAndBasePoints()

bool Player::hasSpellWithAuraNameAndBasePoints ( uint32_t  auraName,
uint32_t  basePoints 
)

Definition at line 4555 of file Player.cpp.

4556{
4557 for (const auto& spellId : m_spellSet)
4558 {
4559 SpellInfo const* spellInfo = sSpellMgr.getSpellInfo(spellId);
4560
4561 for (uint8_t effectIndex = 0; effectIndex < 3; ++effectIndex)
4562 {
4563 if (spellInfo->getEffect(effectIndex) == SPELL_EFFECT_APPLY_AURA)
4564 {
4565 if (spellInfo->getEffectApplyAuraName(effectIndex) == auraName && spellInfo->getEffectBasePoints(effectIndex) == static_cast<int32_t>(basePoints - 1))
4566 return true;
4567 }
4568 }
4569
4570 }
4571
4572 return false;
4573}
uint32_t getEffectApplyAuraName(uint8_t idx) const
int32_t getEffectBasePoints(uint8_t idx) const
uint32_t getEffect(uint8_t idx) const
Here is the call graph for this function:

◆ hasTimedQuestInQuestSlot()

bool Player::hasTimedQuestInQuestSlot ( ) const

Definition at line 8898 of file Player.cpp.

8899{
8900 for (auto& questlogSlot : m_questlog)
8901 if (questlogSlot != nullptr && questlogSlot->getQuestProperties()->time != 0)
8902 return true;
8903
8904 return false;
8905}
Here is the caller graph for this function:

◆ hasWonRbgToday()

bool Player::hasWonRbgToday ( ) const

Definition at line 8571 of file Player.cpp.

8571{ return this->m_hasWonRbgToday; }
Here is the caller graph for this function:

◆ incrementHonorless()

void Player::incrementHonorless ( )

Definition at line 8193 of file Player.cpp.

8193{ m_honorless++; }
Here is the caller graph for this function:

◆ incrementKills()

void Player::incrementKills ( uint32_t  count = 0)

Definition at line 8196 of file Player.cpp.

8197{
8198 if (count)
8199 {
8202 return;
8203 }
8204
8205 m_killsToday++;
8207}
Here is the caller graph for this function:

◆ indoorCheckUpdate()

void Player::indoorCheckUpdate ( uint32_t  time)

Definition at line 2023 of file Player.cpp.

2024{
2025 if (worldConfig.terrainCollision.isCollisionEnabled)
2026 {
2027 if (time >= m_indoorCheckTimer)
2028 {
2029 if (!isOutdoors())
2030 {
2031 // this is duplicated check, but some mount auras comes w/o this flag set, maybe due to spellfixes.cpp line:663
2032 if (isMounted() && !m_taxi->getCurrentTaxiPath())
2033 dismount();
2034
2036 {
2037 auto* const aur = getAuraWithAuraSlot(x);
2038 if (aur && aur->getSpellInfo()->getAttributes() & ATTRIBUTES_ONLY_OUTDOORS)
2039 aur->removeAura();
2040 }
2041 }
2043 }
2044 }
2045}
#define COLLISION_INDOOR_CHECK_INTERVAL
@ ATTRIBUTES_ONLY_OUTDOORS
bool isOutdoors() const
Definition Object.hpp:472
uint32_t m_indoorCheckTimer
Definition Player.hpp:633
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseArenaTeam()

void Player::initialiseArenaTeam ( )

Definition at line 8073 of file Player.cpp.

8074{
8075 for (uint8_t i = 0; i < NUM_ARENA_TEAM_TYPES; ++i)
8076 {
8077 m_arenaTeams[i] = sObjectMgr.getArenaTeamByGuid(getGuidLow(), i);
8078 if (m_arenaTeams[i] != nullptr)
8079 {
8080#if VERSION_STRING != Classic
8081 setArenaTeamId(i, m_arenaTeams[i]->m_id);
8082
8083 if (m_arenaTeams[i]->m_leader == getGuidLow())
8084 setArenaTeamMemberRank(i, 0);
8085 else
8086 setArenaTeamMemberRank(i, 1);
8087#endif
8088 }
8089 }
8090}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseCharters()

void Player::initialiseCharters ( )

Definition at line 7855 of file Player.cpp.

7856{
7857 for (uint8_t i = 0; i < NUM_CHARTER_TYPES; ++i)
7858 m_charters[i] = sObjectMgr.getCharterByGuid(getGuid(), static_cast<CharterTypes>(i));
7859}
CharterTypes
@ NUM_CHARTER_TYPES
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseNoseLevel()

void Player::initialiseNoseLevel ( )

Definition at line 1636 of file Player.cpp.

1637{
1638 // Set the height of the player
1639 switch (getRace())
1640 {
1641 case RACE_HUMAN:
1642 // female
1643 if (getGender())
1644 m_noseLevel = 1.72f;
1645 // male
1646 else
1647 m_noseLevel = 1.78f;
1648 break;
1649 case RACE_ORC:
1650 if (getGender())
1651 m_noseLevel = 1.82f;
1652 else
1653 m_noseLevel = 1.98f;
1654 break;
1655 case RACE_DWARF:
1656 if (getGender())
1657 m_noseLevel = 1.27f;
1658 else
1659 m_noseLevel = 1.4f;
1660 break;
1661 case RACE_NIGHTELF:
1662 if (getGender())
1663 m_noseLevel = 1.84f;
1664 else
1665 m_noseLevel = 2.13f;
1666 break;
1667 case RACE_UNDEAD:
1668 if (getGender())
1669 m_noseLevel = 1.61f;
1670 else
1671 m_noseLevel = 1.8f;
1672 break;
1673 case RACE_TAUREN:
1674 if (getGender())
1675 m_noseLevel = 2.48f;
1676 else
1677 m_noseLevel = 2.01f;
1678 break;
1679 case RACE_GNOME:
1680 if (getGender())
1681 m_noseLevel = 1.06f;
1682 else
1683 m_noseLevel = 1.04f;
1684 break;
1685#if VERSION_STRING >= Cata
1686 case RACE_GOBLIN:
1687 if (getGender())
1688 m_noseLevel = 1.06f;
1689 else
1690 m_noseLevel = 1.04f;
1691 break;
1692#endif
1693 case RACE_TROLL:
1694 if (getGender())
1695 m_noseLevel = 2.02f;
1696 else
1697 m_noseLevel = 1.93f;
1698 break;
1699#if VERSION_STRING > Classic
1700 case RACE_BLOODELF:
1701 if (getGender())
1702 m_noseLevel = 1.83f;
1703 else
1704 m_noseLevel = 1.93f;
1705 break;
1706 case RACE_DRAENEI:
1707 if (getGender())
1708 m_noseLevel = 2.09f;
1709 else
1710 m_noseLevel = 2.36f;
1711 break;
1712#endif
1713#if VERSION_STRING >= Cata
1714 case RACE_WORGEN:
1715 if (getGender())
1716 m_noseLevel = 1.72f;
1717 else
1718 m_noseLevel = 1.78f;
1719 break;
1720#endif
1721 }
1722}
@ RACE_ORC
@ RACE_HUMAN
uint8_t getGender() const
Definition Unit.cpp:459
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseReputation()

void Player::initialiseReputation ( )

Definition at line 11803 of file Player.cpp.

11804{
11805 for (uint32_t i = 0; i < sFactionStore.getNumRows(); ++i)
11806 {
11807 WDB::Structures::FactionEntry const* factionEntry = sFactionStore.lookupEntry(i);
11808 addNewFaction(factionEntry, 0, true);
11809 }
11810}
SERVER_DECL WDB::WDBContainer< WDB::Structures::FactionEntry > sFactionStore
Definition WDBStores.cpp:79
bool addNewFaction(WDB::Structures::FactionEntry const *factionEntry, int32_t standing, bool base)
Definition Player.cpp:11709
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initTaxiNodesForLevel()

void Player::initTaxiNodesForLevel ( )

Definition at line 10780 of file Player.cpp.

10781{
10782 m_taxi->initTaxiNodesForLevel(getRace(), getClass(), getLevel());
10783}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initVisibleUpdateBits()

void Player::initVisibleUpdateBits ( )
static

Definition at line 3316 of file Player.cpp.

3317{
3318#if VERSION_STRING == Mop
3320
3329
3332
3335
3338
3341
3344
3351
3358
3362
3368
3385
3394
3400
3401 for (uint16_t i = 0; i < EQUIPMENT_SLOT_END; ++i)
3402 {
3403 uint32_t offset = i * 2;
3404
3407 }
3408
3409 uint16_t questIdOffset = 5;
3410 for (uint16_t i = getOffsetForStructuredField(WoWPlayer, quests); i < getOffsetForStructuredField(WoWPlayer, visible_items); i += questIdOffset)
3412
3414
3415#else
3419#if VERSION_STRING < Cata
3421#else
3423#endif
3424
3427
3430
3433
3440#if VERSION_STRING == WotLK
3443#endif
3444
3451#if VERSION_STRING == WotLK
3454#endif
3455
3459
3460#if VERSION_STRING <= TBC
3467#endif
3468
3473#if VERSION_STRING != Classic
3475#endif
3476
3492#if VERSION_STRING > TBC
3494#endif
3495
3504#if VERSION_STRING < Cata
3506#endif
3511
3512#if VERSION_STRING == TBC
3519#endif
3520
3521 for (uint16_t i = 0; i < EQUIPMENT_SLOT_END; ++i)
3522 {
3523#if VERSION_STRING > TBC
3524 uint32_t offset = i * 2;
3525#else
3526 uint32_t offset = i * 16;
3527#endif
3528 // visible_items includes creator guid, so add + 2 since we are not sending that as update field
3531 }
3532
3533#if VERSION_STRING == Classic
3534 uint16_t questIdOffset = 3;
3535#elif VERSION_STRING == TBC
3536 uint16_t questIdOffset = 4;
3537#else
3538 uint16_t questIdOffset = 5;
3539#endif
3540
3541 for (uint16_t i = getOffsetForStructuredField(WoWPlayer, quests); i < getOffsetForStructuredField(WoWPlayer, visible_items); i += questIdOffset)
3543
3544#if VERSION_STRING != Classic
3546#endif
3547#endif
3548}
#define getOffsetForStructuredField(s, m)
#define getOffsetForStructuredArrayField(s, m, index)
static UpdateMask m_visibleUpdateMask
Definition Player.hpp:772
void SetBit(const uint32_t index)
Definition UpdateMask.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAllowedToCreateCorpse()

bool Player::isAllowedToCreateCorpse ( ) const

Definition at line 7440 of file Player.cpp.

7441{
7443}
bool m_isCorpseCreationAllowed
Definition Player.hpp:1214
Here is the caller graph for this function:

◆ isAlreadyInvitedToGroup()

bool Player::isAlreadyInvitedToGroup ( ) const

Definition at line 7883 of file Player.cpp.

7883{ return m_grouIdpInviterId != 0; }
Here is the caller graph for this function:

◆ isAppearingDisabled()

bool Player::isAppearingDisabled ( ) const

Definition at line 2328 of file Player.cpp.

2328{ return m_disableAppearing; }
Here is the caller graph for this function:

◆ isAtGroupRewardDistance()

bool Player::isAtGroupRewardDistance ( Object pRewardSource)

Definition at line 10137 of file Player.cpp.

10138{
10139 if (!pRewardSource)
10140 return false;
10141
10142 Object* player = nullptr;
10143 const auto corpse = sObjectMgr.getCorpseByOwner(getGuidLow());
10144 if (corpse)
10145 player = sObjectMgr.getPlayer(static_cast<uint32_t>(corpse->getOwnerGuid()));
10146
10147 if (!player || isAlive())
10148 player = this;
10149
10150 if (player->GetMapId() != pRewardSource->GetMapId() || player->GetInstanceID() != pRewardSource->GetInstanceID())
10151 return false;
10152
10153 return pRewardSource->getDistance(player) <= 75.0f;
10154}
float getDistance(Object const *obj) const
Definition Object.cpp:5040
Here is the call graph for this function:

◆ isAttacking()

bool Player::isAttacking ( )
inline

Definition at line 2191 of file Player.hpp.

2191{ return m_attacking; }

◆ isBanned()

bool Player::isBanned ( ) const

Definition at line 2330 of file Player.cpp.

2331{
2332 if (m_banned)
2333 {
2334 if (m_banned < 100 || static_cast<uint32_t>(UNIXTIME) < m_banned)
2335 return true;
2336 }
2337 return false;
2338}
uint32_t m_banned
Definition Player.hpp:1106
Here is the caller graph for this function:

◆ isClassDeathKnight()

bool Player::isClassDeathKnight ( ) const
virtual

Reimplemented in DeathKnight.

Definition at line 2763 of file Player.cpp.

2763{ return false; }
Here is the caller graph for this function:

◆ isClassDruid()

bool Player::isClassDruid ( ) const
virtual

Reimplemented in Druid.

Definition at line 2772 of file Player.cpp.

2772{ return false; }
Here is the caller graph for this function:

◆ isClassHunter()

bool Player::isClassHunter ( ) const
virtual

Reimplemented in Hunter.

Definition at line 2767 of file Player.cpp.

2767{ return false; }
Here is the caller graph for this function:

◆ isClassMage()

bool Player::isClassMage ( ) const
virtual

Reimplemented in Mage.

Definition at line 2762 of file Player.cpp.

2762{ return false; }

◆ isClassMonk()

bool Player::isClassMonk ( ) const
virtual

Reimplemented in Monk.

Definition at line 2771 of file Player.cpp.

2771{ return false; }

◆ isClassPaladin()

bool Player::isClassPaladin ( ) const
virtual

Reimplemented in Paladin.

Definition at line 2770 of file Player.cpp.

2770{ return false; }
Here is the caller graph for this function:

◆ isClassPriest()

bool Player::isClassPriest ( ) const
virtual

Reimplemented in Priest.

Definition at line 2764 of file Player.cpp.

2764{ return false; }

◆ isClassRogue()

bool Player::isClassRogue ( ) const
virtual

Reimplemented in Rogue.

Definition at line 2765 of file Player.cpp.

2765{ return false; }

◆ isClassShaman()

bool Player::isClassShaman ( ) const
virtual

Reimplemented in Shaman.

Definition at line 2766 of file Player.cpp.

2766{ return false; }

◆ isClassWarlock()

bool Player::isClassWarlock ( ) const
virtual

Reimplemented in Warlock.

Definition at line 2768 of file Player.cpp.

2768{ return false; }

◆ isClassWarrior()

bool Player::isClassWarrior ( ) const
virtual

Reimplemented in Warrior.

Definition at line 2769 of file Player.cpp.

2769{ return false; }

◆ isFactionAtWar()

bool Player::isFactionAtWar ( WDB::Structures::FactionEntry const factionEntry) const

Definition at line 11577 of file Player.cpp.

11578{
11579 if (!factionEntry)
11580 return false;
11581
11582 FactionReputation const* factionState = m_reputationByListId[factionEntry->RepListId];
11583 if (factionState == nullptr)
11584 return false;
11585
11586 return AtWar(factionState->flag);
11587
11588 return false;
11589}
bool AtWar(uint8_t flag)
Definition Player.cpp:11315
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFfaPvpFlagSet()

bool Player::isFfaPvpFlagSet ( ) const
overridevirtual

Reimplemented from Unit.

Definition at line 9819 of file Player.cpp.

9820{
9821#if VERSION_STRING > TBC
9822 return getPvpFlags() & PVP_STATE_FLAG_FFA_PVP;
9823#else
9824 return hasPlayerFlags(PLAYER_FLAG_FREE_FOR_ALL_PVP);
9825#endif
9826}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFriended()

bool Player::isFriended ( uint32_t  guid) const

Definition at line 9211 of file Player.cpp.

9212{
9213 std::lock_guard<std::mutex> guard(m_mutexFriendList);
9214 for (const auto friends : m_socialIFriends)
9215 {
9216 if (friends.friendGuid == guid)
9217 return true;
9218 }
9219 return false;
9220}
Here is the caller graph for this function:

◆ isGMFlagSet()

bool Player::isGMFlagSet ( ) const

Definition at line 9381 of file Player.cpp.

9382{
9384}
@ PLAYER_FLAG_GM
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isGroupLeader()

bool Player::isGroupLeader ( ) const

Definition at line 7888 of file Player.cpp.

7889{
7890 if (m_playerInfo->m_Group != nullptr)
7891 {
7893 return true;
7894 }
7895 return false;
7896}
CachedCharacterInfo * GetLeader(void)
Definition Group.h:205
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isHostileBasedOnReputation()

bool Player::isHostileBasedOnReputation ( WDB::Structures::FactionEntry const factionEntry)

Definition at line 11591 of file Player.cpp.

11592{
11593 if (!factionEntry)
11594 return false;
11595
11596 if (factionEntry->RepListId < 0 || factionEntry->RepListId >= 128)
11597 return false;
11598
11599 FactionReputation* factionReputation = m_reputationByListId[factionEntry->RepListId];
11600 if (factionReputation == nullptr)
11601 return false;
11602
11603 const auto itr = m_forcedReactions.find(factionEntry->ID);
11604 if (itr != m_forcedReactions.end())
11605 return itr->second <= STANDING_HOSTILE;
11606
11607 return AtWar(factionReputation->flag) || getReputationRankFromStanding(factionReputation->standing) <= STANDING_HOSTILE;
11608}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isIgnored()

bool Player::isIgnored ( uint32_t  guid) const

Definition at line 9358 of file Player.cpp.

9359{
9360 std::lock_guard<std::mutex> guard(m_mutexIgnoreList);
9361 if (std::find(m_socialIgnoring.begin(), m_socialIgnoring.end(), guid) != m_socialIgnoring.end())
9362 return true;
9363
9364 return false;
9365}
Here is the caller graph for this function:

◆ isInArenaTeam()

bool Player::isInArenaTeam ( uint8_t  type) const

Definition at line 8072 of file Player.cpp.

8072{ return m_arenaTeams[type] != nullptr; }
Here is the caller graph for this function:

◆ isInCity()

bool Player::isInCity ( ) const

Definition at line 1537 of file Player.cpp.

1538{
1539 if (const auto at = GetArea())
1540 {
1541 ::WDB::Structures::AreaTableEntry const* zt = nullptr;
1542 if (at->zone)
1544
1547
1548 return (areaIsCity || zoneIsCity);
1549 }
1550
1551 return false;
1552}
Here is the call graph for this function:

◆ isInDisallowedMountForm()

bool Player::isInDisallowedMountForm ( ) const

Definition at line 4125 of file Player.cpp.

4126{
4128 {
4129 WDB::Structures::SpellShapeshiftFormEntry const* shapeshift = sSpellShapeshiftFormStore.lookupEntry(form);
4130 if (!shapeshift)
4131 return true;
4132
4133 if (!(shapeshift->Flags & 0x1))
4134 return true;
4135 }
4136
4138 return false;
4139
4141 if (!display)
4142 return true;
4143
4145 if (!displayExtra)
4146 return true;
4147
4148 WDB::Structures::CreatureModelDataEntry const* model = sCreatureModelDataStore.lookupEntry(display->ModelID);
4149 WDB::Structures::ChrRacesEntry const* race = sChrRacesStore.lookupEntry(displayExtra->Race);
4150
4151 if (model && !(model->Flags & 0x80))
4152 if (race && !(race->flags & 0x4))
4153 return true;
4154
4155 return false;
4156}
UnitBytes_ShapeshiftForm
SERVER_DECL WDB::WDBContainer< WDB::Structures::CreatureDisplayInfoExtraEntry > sCreatureDisplayInfoExtraStore
Definition WDBStores.cpp:69
SERVER_DECL WDB::WDBContainer< WDB::Structures::CreatureDisplayInfoEntry > sCreatureDisplayInfoStore
Definition WDBStores.cpp:68
SERVER_DECL WDB::WDBContainer< WDB::Structures::CreatureModelDataEntry > sCreatureModelDataStore
Definition WDBStores.cpp:70
SERVER_DECL WDB::WDBContainer< WDB::Structures::SpellShapeshiftFormEntry > sSpellShapeshiftFormStore
uint32_t getNativeDisplayId() const
Definition Unit.cpp:1275
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInFeralForm()

bool Player::isInFeralForm ( )

Definition at line 4113 of file Player.cpp.

4114{
4115 //\todo shapeshiftform is never negative.
4116 int s = getShapeShiftForm();
4117 if (s <= 0)
4118 return false;
4119
4120 // Fight forms that do not use player's weapon
4121 return (s == FORM_BEAR || s == FORM_DIREBEAR || s == FORM_CAT); //Shady: actually ghostwolf form doesn't use weapon too.
4122}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInFlight()

bool Player::isInFlight ( ) const

Definition at line 10770 of file Player.cpp.

10771{
10773}
@ UNIT_STATE_IN_FLIGHT
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInGroup()

bool Player::isInGroup ( ) const

Definition at line 7885 of file Player.cpp.

7885{ return m_playerInfo && m_playerInfo->m_Group; }
Here is the caller graph for this function:

◆ isInGuild()

bool Player::isInGuild ( )

Definition at line 7866 of file Player.cpp.

7866{ return getGuild() != nullptr; }
Guild * getGuild() const
Definition Player.cpp:7865
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isLootableOnCorpse()

bool Player::isLootableOnCorpse ( ) const

Definition at line 11309 of file Player.cpp.

11309{ return m_lootableOnCorpse; }

◆ isMoving()

bool Player::isMoving ( ) const

Definition at line 1510 of file Player.cpp.

1510{ return m_isMoving; }
bool m_isMoving
Definition Player.hpp:618
Here is the caller graph for this function:

◆ isOnGMTargetList()

bool Player::isOnGMTargetList ( uint32_t  guid) const

Definition at line 2411 of file Player.cpp.

2412{
2413 std::lock_guard<std::mutex> guard(m_lockGMTargetList);
2414 if (std::find(m_gmPlayerTargetList.begin(), m_gmPlayerTargetList.end(), guid) != m_gmPlayerTargetList.end())
2415 return true;
2416
2417 return false;
2418}

◆ isOnTaxi()

bool Player::isOnTaxi ( ) const

Definition at line 10775 of file Player.cpp.

10776{
10777 return !m_taxi->empty();
10778}
Here is the caller graph for this function:

◆ isOnVehicle()

bool Player::isOnVehicle ( ) const

Definition at line 1515 of file Player.cpp.

1515{ return m_mountVehicleId ? true : false; }
Here is the caller graph for this function:

◆ isPetRequiringTemporaryUnsummon()

bool Player::isPetRequiringTemporaryUnsummon ( ) const

Definition at line 12593 of file Player.cpp.

12594{
12595 if (!IsInWorld() || !isAlive())
12596 return true;
12597
12598 if (isOnTaxi())
12599 return true;
12600
12601 // In classic pets were not despawned when mounted
12602 // In tbc and wotlk they despawned, but this was again changed around patch 4.1
12603#if VERSION_STRING == TBC || VERSION_STRING == WotLK
12604#ifdef FT_VEHICLES
12605 if (isMounted() || isOnVehicle())
12606#else
12607 if (isMounted())
12608#endif
12609 {
12610 if (const auto* const pet = getPet())
12611 {
12612 if (!pet->isAlive())
12613 return false;
12614
12615 if (!pet->isPermanentSummon())
12616 return false;
12617
12618 if (m_bg != nullptr && m_bg->isArena())
12619 return false;
12620
12621 // For some reason permanent water elemental is not despawned
12622 if (pet->getEntry() == PET_WATER_ELEMENTAL_NEW)
12623 return false;
12624 }
12625
12626 return true;
12627 }
12628#endif
12629
12630 return false;
12631}
@ PET_WATER_ELEMENTAL_NEW
bool isOnTaxi() const
Definition Player.cpp:10775
bool isOnVehicle() const
Definition Player.cpp:1515
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isPvpFlagSet()

bool Player::isPvpFlagSet ( ) const
overridevirtual

Reimplemented from Unit.

Definition at line 9781 of file Player.cpp.

9782{
9783#if VERSION_STRING > TBC
9784 return getPvpFlags() & PVP_STATE_FLAG_PVP;
9785#else
9786 return getUnitFlags() & UNIT_FLAG_PVP;
9787#endif
9788}
@ UNIT_FLAG_PVP
uint32_t getUnitFlags() const
Definition Unit.cpp:1107
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isQueuedForBg()

bool Player::isQueuedForBg ( ) const

Definition at line 8552 of file Player.cpp.

8552{ return m_isQueuedForBg; }
bool m_isQueuedForBg
Definition Player.hpp:1458
Here is the caller graph for this function:

◆ isQueuedForRbg()

bool Player::isQueuedForRbg ( ) const

Definition at line 8559 of file Player.cpp.

8559{ return this->m_isQueuedForRbg; }
bool m_isQueuedForRbg
Definition Player.hpp:1461

◆ isSanctuaryFlagSet()

bool Player::isSanctuaryFlagSet ( ) const
overridevirtual

Reimplemented from Unit.

Definition at line 9852 of file Player.cpp.

9853{
9854#if VERSION_STRING > TBC
9855 return getPvpFlags() & PVP_STATE_FLAG_SANCTUARY;
9856#elif VERSION_STRING == TBC
9857 return hasPlayerFlags(PLAYER_FLAG_SANCTUARY);
9858#elif VERSION_STRING == Classic
9859 return false;
9860#endif
9861}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSendOnlyRaidgroupSet()

bool Player::isSendOnlyRaidgroupSet ( ) const

Definition at line 7953 of file Player.cpp.

7953{ return m_sendOnlyRaidgroup; }

◆ isSpellFitByClassAndRace()

bool Player::isSpellFitByClassAndRace ( uint32_t  spell_id) const

Definition at line 4271 of file Player.cpp.

4272{
4273 const auto spellSkillRange = sSpellMgr.getSkillEntryRangeForSpell(spell_id);
4274
4275 // If spell does not exist in sSkillLineAbilityStore assume it fits for player
4276 if (spellSkillRange.empty())
4277 return true;
4278
4279 const auto raceMask = getRaceMask();
4280 const auto classMask = getClassMask();
4281
4282 for (const auto& [_, skillEntry] : spellSkillRange)
4283 {
4284 // skip wrong race skills
4285 if (skillEntry->race_mask > 0 && !(skillEntry->race_mask & raceMask))
4286 continue;
4287
4288 // skip wrong class skills
4289 if (skillEntry->class_mask > 0 && !(skillEntry->class_mask & classMask))
4290 continue;
4291
4292 return true;
4293 }
4294
4295 return false;
4296}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSummoningDisabled()

bool Player::isSummoningDisabled ( ) const

Definition at line 2326 of file Player.cpp.

2326{ return m_disableSummoning; }
Here is the caller graph for this function:

◆ isTeamAlliance()

bool Player::isTeamAlliance ( ) const

Definition at line 2788 of file Player.cpp.

2788{ return getTeam() == TEAM_ALLIANCE; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTeamHorde()

bool Player::isTeamHorde ( ) const

Definition at line 2787 of file Player.cpp.

2787{ return getTeam() == TEAM_HORDE; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTransferPending()

bool Player::isTransferPending ( ) const

Definition at line 1891 of file Player.cpp.

1891{ return getTransferStatus() == TRANSFER_PENDING; }
uint8_t getTransferStatus() const
Definition Player.cpp:1890
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isVisibleObject()

bool Player::isVisibleObject ( uint64_t  guid)

Definition at line 3599 of file Player.cpp.

3599{ return m_visibleObjects.contains(guid); }
Here is the caller graph for this function:

◆ joinedChannel()

void Player::joinedChannel ( Channel channel)

Definition at line 7960 of file Player.cpp.

7961{
7962 if (channel == nullptr)
7963 return;
7964
7965 std::lock_guard<std::mutex> guard(m_mutexChannel);
7966 m_channels.insert(channel);
7967}
std::mutex m_mutexChannel
Definition Player.hpp:1337
std::set< Channel * > m_channels
Definition Player.hpp:1336
Here is the caller graph for this function:

◆ kickFromServer()

void Player::kickFromServer ( uint32_t  delay = 0)

Definition at line 2354 of file Player.cpp.

2355{
2356 if (delay)
2357 {
2358 m_kickDelay = delay;
2360 }
2361 else
2362 {
2363 m_kickDelay = 0;
2365 }
2366}
void eventKickFromServer()
Definition Player.cpp:2368
Here is the call graph for this function:
Here is the caller graph for this function:

◆ learnInitialSkills()

void Player::learnInitialSkills ( )

Definition at line 4956 of file Player.cpp.

4957{
4958 for (const auto& skill : m_playerCreateInfo->skills)
4959 {
4960 if (skill.skillid == 0)
4961 continue;
4962
4963 const auto skillLine = sSkillLineStore.lookupEntry(skill.skillid);
4964 if (skillLine == nullptr)
4965 continue;
4966
4967 // Set current skill values for Death Knight's weapon skills
4968 auto curVal = skill.currentval;
4969 if (isClassDeathKnight() && skillLine->type == SKILL_TYPE_WEAPON && skillLine->id != SKILL_DUAL_WIELD)
4970 curVal = static_cast<uint16_t>((std::min(55U, getLevel()) - 1) * 5);
4971
4972 addSkillLine(skill.skillid, curVal, 0);
4973 }
4974}
virtual bool isClassDeathKnight() const
Definition Player.cpp:2763
Here is the call graph for this function:
Here is the caller graph for this function:

◆ learnSkillSpells()

void Player::learnSkillSpells ( uint16_t  skillLine,
uint16_t  currentValue 
)

Definition at line 4976 of file Player.cpp.

4977{
4978 const auto raceMask = getRaceMask();
4979 const auto classMask = getClassMask();
4980
4981 const auto skillRange = sSpellMgr.getSkillEntryRangeForSkill(skillLine);
4982 for (const auto& [_, skillEntry] : skillRange)
4983 {
4984 if (skillEntry->acquireMethod != 1 && skillEntry->acquireMethod != 2)
4985 continue;
4986
4987 // Check race mask
4988 if (skillEntry->race_mask != 0 && !(skillEntry->race_mask & raceMask))
4989 continue;
4990
4991 // Check class mask
4992 if (skillEntry->class_mask != 0 && !(skillEntry->class_mask & classMask))
4993 continue;
4994
4995 // Check skill value
4996 if (currentValue < skillEntry->minSkillLineRank)
4997 continue;
4998
4999 // Add automatically acquired spells
5000 addSpell(skillEntry->spell, skillLine);
5001 }
5002}
void addSpell(uint32_t spellId, uint16_t fromSkill=0)
Definition Player.cpp:3935
Here is the call graph for this function:
Here is the caller graph for this function:

◆ learnTalent()

void Player::learnTalent ( uint32_t  talentId,
uint32_t  talentRank 
)

Definition at line 5815 of file Player.cpp.

5816{
5817 auto curTalentPoints = getActiveSpec().getTalentPoints();
5818 if (curTalentPoints == 0)
5819 return;
5820
5821 if (talentRank > 4)
5822 return;
5823
5824 auto talentInfo = sTalentStore.lookupEntry(talentId);
5825 if (talentInfo == nullptr)
5826 return;
5827#if VERSION_STRING < Mop
5828 if (sSpellMgr.isSpellDisabled(talentInfo->RankID[talentRank]))
5829 {
5830 if (IsInWorld())
5831 sendCastFailedPacket(talentInfo->RankID[talentRank], SPELL_FAILED_SPELL_UNAVAILABLE, 0, 0);
5832 return;
5833 }
5834
5835 // Check if player already has the talent with same or higher rank
5836 for (auto i = talentRank; i <= 4; ++i)
5837 {
5838 if (talentInfo->RankID[i] != 0 && hasSpell(talentInfo->RankID[i]))
5839 return;
5840 }
5841
5842 // Check if talent tree is for player's class
5843 auto talentTreeInfo = sTalentTabStore.lookupEntry(talentInfo->TalentTree);
5844 if (talentTreeInfo == nullptr || !(getClassMask() & talentTreeInfo->ClassMask))
5845 return;
5846
5847#if VERSION_STRING >= Cata
5848 // Check if enough talent points are spent in the primary talent tree before unlocking other trees
5849 if (talentInfo->TalentTree != m_FirstTalentTreeLock && m_FirstTalentTreeLock != 0)
5850 {
5851 auto pointsUsed = 0;
5852 for (const auto& [talentId, rank] : getActiveSpec().getTalents())
5853 {
5854 pointsUsed += rank + 1;
5855 }
5856
5857 // You need to spent 31 points in the primary tree before you're able to unlock other trees
5858 if (pointsUsed < 31)
5859 return;
5860 }
5861#endif
5862
5863 // Check if talent requires another talent
5864 if (talentInfo->DependsOn > 0)
5865 {
5866 auto dependsOnTalent = sTalentStore.lookupEntry(talentInfo->DependsOn);
5867 if (dependsOnTalent != nullptr)
5868 {
5869 auto hasEnoughRank = false;
5870 for (auto i = 0; i <= 4; ++i)
5871 {
5872 if (dependsOnTalent->RankID[i] != 0)
5873 {
5874 if (hasSpell(dependsOnTalent->RankID[i]))
5875 {
5876 hasEnoughRank = true;
5877 break;
5878 }
5879 }
5880 }
5881 if (!hasEnoughRank)
5882 return;
5883 }
5884 }
5885
5886 auto spellId = talentInfo->RankID[talentRank];
5887 if (spellId == 0)
5888 {
5889 sLogger.info("Player::learnTalent: Player tried to learn talent {} (rank {}) but talent's spell id is 0.", talentId, talentRank);
5890 return;
5891 }
5892
5893 // Check can player yet access this talent
5894 uint32_t spentPoints = 0;
5895 if (talentInfo->Row > 0)
5896 {
5897 // Loop through player's talents
5898 for (const auto& [talent, rank] : getActiveSpec().getTalents())
5899 {
5900 auto tmpTalent = sTalentStore.lookupEntry(talent);
5901 if (tmpTalent == nullptr)
5902 continue;
5903 // Skip talents from other trees
5904 if (tmpTalent->TalentTree != talentInfo->TalentTree)
5905 continue;
5906 spentPoints += rank + 1;
5907 }
5908 }
5909
5910 if (spentPoints < (talentInfo->Row * 5))
5911 return;
5912
5913 // Get current talent rank
5914 uint8_t curTalentRank = 0;
5915 auto isMultiRankTalent = false;
5916 for (int8_t _talentRank = 4; _talentRank >= 0; --_talentRank)
5917 {
5918 if (talentInfo->RankID[_talentRank] != 0)
5919 {
5920 if (_talentRank > 0)
5921 isMultiRankTalent = true;
5922
5923 if (hasSpell(talentInfo->RankID[_talentRank]))
5924 {
5925 curTalentRank = _talentRank + 1;
5926 break;
5927 }
5928 }
5929 }
5930
5931 // Check does player have enough talent points
5932 auto requiredTalentPoints = (talentRank + 1) - curTalentRank;
5933 if (curTalentPoints < requiredTalentPoints)
5934 return;
5935
5936 // Check if player already knows this or higher rank
5937 if (curTalentRank >= (talentRank + 1))
5938 return;
5939
5940 // Check if player already has the talent spell
5941 if (hasSpell(spellId))
5942 return;
5943
5944 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
5945 if (spellInfo == nullptr)
5946 return;
5947
5948 _addSpell(spellId, 0, isMultiRankTalent);
5949
5950#if VERSION_STRING >= Cata
5951 // Set primary talent tree and lock others
5952 if (m_FirstTalentTreeLock == 0)
5953 {
5954 m_FirstTalentTreeLock = talentInfo->TalentTree;
5955 // TODO: learning Mastery and spec spells
5956 // also need to handle them in talent reset
5957 }
5958#endif
5959
5960 // Add the new talent to player talent map
5961 getActiveSpec().addTalent(talentId, static_cast<uint8_t>(talentRank));
5962 setTalentPoints(curTalentPoints - requiredTalentPoints, false);
5963#endif
5964}
@ SPELL_FAILED_SPELL_UNAVAILABLE
SERVER_DECL WDB::WDBContainer< WDB::Structures::TalentTabEntry > sTalentTabStore
void addTalent(uint32_t talentId, uint8_t rankId)
uint32_t getTalentPoints() const
void sendCastFailedPacket(uint32_t spellId, uint8_t errorMessage, uint8_t multiCast, uint32_t extra1, uint32_t extra2=0)
Definition Player.cpp:9714
uint32_t m_FirstTalentTreeLock
Definition Player.hpp:1990
Here is the call graph for this function:
Here is the caller graph for this function:

◆ leftChannel()

void Player::leftChannel ( Channel channel)

Definition at line 7969 of file Player.cpp.

7970{
7971 if (channel == nullptr)
7972 return;
7973
7974 std::lock_guard<std::mutex> guard(m_mutexChannel);
7975 m_channels.erase(channel);
7976}
Here is the caller graph for this function:

◆ loadBoundInstances()

void Player::loadBoundInstances ( )

Definition at line 12729 of file Player.cpp.

12730{
12731 for (uint8_t i = 0; i < InstanceDifficulty::MAX_DIFFICULTY; ++i)
12732 m_boundInstances[i].clear();
12733
12734 auto group = getGroup();
12735
12736 // 0 1 2 3 4 5
12737 auto result = CharacterDatabase.Query("SELECT id, permanent, map, difficulty, extendState, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = %u", getGuidLow());
12738 if (result)
12739 {
12740 do
12741 {
12742 Field* fields = result->Fetch();
12743
12744 bool perm = fields[1].asBool();
12745 uint32_t mapId = fields[2].asUint16();
12746 uint32_t instanceId = fields[0].asUint32();
12747 uint8_t difficulty = fields[3].asUint8();
12748 BindExtensionState extendState = BindExtensionState(fields[4].asUint8());
12749
12750 time_t resetTime = time_t(fields[5].asUint64());
12751 bool deleteInstance = false;
12752
12753 WDB::Structures::MapEntry const* mapEntry = sMapStore.lookupEntry(mapId);
12754#if VERSION_STRING > WotLK
12755 std::string mapname = mapEntry ? mapEntry->map_name[0] : "Unknown";
12756#else
12757 std::string mapname = mapEntry ? mapEntry->map_name[sWorld.getDbcLocaleLanguageId()] : "Unknown";
12758#endif
12759
12760 if (!mapEntry || !mapEntry->isInstanceMap())
12761 {
12762 sLogger.failure("Player::loadBoundInstances: Player '{}' ({}) has bind to not existed or not dungeon map {} ({})",
12763 getName(), getGuid(), mapId, mapname);
12764 deleteInstance = true;
12765 }
12766 else if (difficulty >= InstanceDifficulty::MAX_DIFFICULTY)
12767 {
12768 sLogger.failure("entities.player", "Player::loadBoundInstances: player '{}' ({}) has bind to not existed difficulty {} instance for map {} ({})",
12769 getName(), getGuid(), difficulty, mapId, mapname);
12770 deleteInstance = true;
12771 }
12772 else
12773 {
12775 if (!mapDiff)
12776 {
12777 sLogger.failure("entities.player", "Player::loadBoundInstances: player '{}' ({}) has bind to not existed difficulty {} instance for map {} ({})",
12778 getName(), getGuid(), difficulty, mapId, mapname);
12779 deleteInstance = true;
12780 }
12781 else if (!perm && group)
12782 {
12783 sLogger.failure("entities.player", "Player::loadBoundInstances: player '{}' ({}) is in group {} but has a non-permanent character bind to map {} ({}), {}, {}",
12784 getName(), getGuid(), group->GetGUID(), mapId, mapname, instanceId, difficulty);
12785 deleteInstance = true;
12786 }
12787 }
12788
12789 if (deleteInstance)
12790 {
12791 CharacterDatabase.Execute("DELETE FROM character_instance WHERE guid = %u AND instance = %u", getGuidLow(), instanceId);
12792 continue;
12793 }
12794
12795 // since non permanent binds are always solo bind, they can always be reset
12796 if (InstanceSaved* save = sInstanceMgr.addInstanceSave(mapId, instanceId, InstanceDifficulty::Difficulties(difficulty), resetTime, !perm, true))
12797 bindToInstance(save, perm, extendState, true);
12798
12799 } while (result->NextRow());
12800 }
12801}
BindExtensionState
WDB::Structures::MapDifficulty const * getMapDifficultyData(uint32_t mapId, InstanceDifficulty::Difficulties difficulty)
SERVER_DECL WDB::WDBContainer< WDB::Structures::MapEntry > sMapStore
Definition WDBStores.cpp:91
#define sWorld
Definition World.h:244
uint16_t asUint16(bool _silencedError=false) const
Definition Field.cpp:21
char * map_name[NAME_PATTERN]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadDeletedSpells()

bool Player::loadDeletedSpells ( QueryResult result)

Definition at line 13427 of file Player.cpp.

13428{
13429 if (result == nullptr)
13430 return false;
13431
13432 do
13433 {
13434 Field* fields = result->Fetch();
13435 uint32_t spellid = fields[0].asUint32();
13436
13437 const auto* const spellInfo = sSpellMgr.getSpellInfo(spellid);
13438 if (spellInfo == nullptr)
13439 continue;
13440
13441 if (sSpellMgr.isSpellDisabled(spellid))
13442 continue;
13443
13444 m_deletedSpellSet.emplace(spellid);
13445 } while (result->NextRow());
13446
13447 return true;
13448}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFieldsFromString()

void Player::loadFieldsFromString ( const char *  string,
uint16_t  firstField,
uint32_t  fieldsNum 
)

Definition at line 13174 of file Player.cpp.

13175{
13176 if (string == nullptr)
13177 return;
13178
13179 char* start = (char*)string;
13180 for (uint16_t Counter = 0; Counter < fieldsNum; Counter++)
13181 {
13182 char* end = strchr(start, ',');
13183 if (!end)
13184 break;
13185
13186 *end = 0;
13187 setExploredZone(Counter, std::stoul(start));
13188 start = end + 1;
13189 }
13190}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFriendedByOthersList()

void Player::loadFriendedByOthersList ( )

Definition at line 9090 of file Player.cpp.

9091{
9092 if (auto result = CharacterDatabase.Query("SELECT character_guid FROM social_friends WHERE friend_guid = %u", getGuidLow()))
9093 {
9094 do
9095 {
9096 auto* const socialField = result->Fetch();
9097 uint32_t friendedByGuid= socialField[0].asUint32();
9098
9099 m_socialFriendedByGuids.push_back(friendedByGuid);
9100
9101 } while (result->NextRow());
9102 }
9103}
std::vector< uint32_t > m_socialFriendedByGuids
Definition Player.hpp:1562
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFriendList()

void Player::loadFriendList ( )

Definition at line 9072 of file Player.cpp.

9073{
9074 if (auto result = CharacterDatabase.Query("SELECT * FROM social_friends WHERE character_guid = %u", getGuidLow()))
9075 {
9076 do
9077 {
9078 SocialFriends socialFriend;
9079
9080 auto* const socialField = result->Fetch();
9081 socialFriend.friendGuid = socialField[1].asUint32();
9082 socialFriend.note = socialField[2].asCString();
9083
9084 m_socialIFriends.push_back(socialFriend);
9085
9086 } while (result->NextRow());
9087 }
9088}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFromDB()

bool Player::loadFromDB ( uint32_t  guid)

Definition at line 14525 of file Player.cpp.

14526{
14527 auto q = std::make_unique<AsyncQuery>(std::make_unique<SQLClassCallbackP0<Player>>(this, &Player::loadFromDBProc));
14528
14529 q->AddQuery("SELECT * FROM characters WHERE guid = %u AND login_flags = %u", guid, (uint32_t)LOGIN_NO_FLAG); // 0
14530 q->AddQuery("SELECT * FROM tutorials WHERE playerId = %u", guid); // 1
14531 q->AddQuery("SELECT cooldown_type, cooldown_misc, cooldown_expire_time, cooldown_spellid, cooldown_itemid FROM playercooldowns WHERE player_guid = %u", guid); // 2
14532 q->AddQuery("SELECT * FROM questlog WHERE player_guid = %u", guid); // 3
14533 q->AddQuery("SELECT * FROM playeritems WHERE ownerguid = %u ORDER BY containerslot ASC", guid); // 4
14534 q->AddQuery("SELECT * FROM playerpets WHERE ownerguid = %u ORDER BY petnumber", guid); // 5
14535 q->AddQuery("SELECT * FROM playersummonspells where ownerguid = %u ORDER BY entryid", guid); // 6
14536 q->AddQuery("SELECT * FROM mailbox WHERE player_guid = %u", guid); // 7
14537
14538 // social
14539 q->AddQuery("SELECT friend_guid, note FROM social_friends WHERE character_guid = %u", guid); // 8
14540 q->AddQuery("SELECT character_guid FROM social_friends WHERE friend_guid = %u", guid); // 9
14541 q->AddQuery("SELECT ignore_guid FROM social_ignores WHERE character_guid = %u", guid); // 10
14542
14543
14544 q->AddQuery("SELECT * FROM equipmentsets WHERE ownerguid = %u", guid); // 11
14545 q->AddQuery("SELECT faction, flag, basestanding, standing FROM playerreputations WHERE guid = %u", guid); //12
14546 q->AddQuery("SELECT SpellID FROM playerspells WHERE GUID = %u", guid); // 13
14547 q->AddQuery("SELECT SpellID FROM playerdeletedspells WHERE GUID = %u", guid); // 14
14548 q->AddQuery("SELECT SkillID, CurrentValue, MaximumValue FROM playerskills WHERE GUID = %u", guid); // 15
14549
14550 //Achievements
14551 q->AddQuery("SELECT achievement, date FROM character_achievement WHERE guid = '%u'", guid); // 16
14552 q->AddQuery("SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", guid); // 17
14553
14554 // queue it!
14555 setGuidLow(guid);
14556 CharacterDatabase.QueueAsyncQuery(std::move(q));
14557 return true;
14558}
@ LOGIN_NO_FLAG
void loadFromDBProc(QueryResultVector &results)
Definition Player.cpp:14560
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFromDBProc()

void Player::loadFromDBProc ( QueryResultVector results)

Definition at line 14560 of file Player.cpp.

14561{
14562 auto startTime = Util::TimeNow();
14563
14564 if (getSession() == nullptr || results.size() < 8) // should have 8 queryresults for aplayer load.
14565 {
14567 return;
14568 }
14569
14570 QueryResult* result = results[PlayerQuery::LoginFlags].result.get();
14571 if (!result)
14572 {
14573 sLogger.failure("Player login query failed! guid = {}", getGuidLow());
14575 return;
14576 }
14577
14578 const uint32_t fieldcount = 95;
14579 if (result->GetFieldCount() != fieldcount)
14580 {
14581 sLogger.failure("Expected {} fields from the database, but received {}! You may need to update your character database.", fieldcount, uint32_t(result->GetFieldCount()));
14583 return;
14584 }
14585
14586 Field* field = result->Fetch();
14587 if (field[1].asUint32() != m_session->GetAccountId())
14588 {
14589 sCheatLog.writefromsession(m_session, "player tried to load character not belonging to them (guid %u, on account %u)",
14590 field[0].asUint32(), field[1].asUint32());
14592 return;
14593 }
14594
14595 uint32_t banned = field[34].asUint32();
14596 if (banned && (banned < 100 || banned >(uint32_t)UNIXTIME))
14597 {
14599 return;
14600 }
14601
14602 m_name = field[2].asCString();
14603
14604 // Load race/class from fields
14605 setRace(field[3].asUint8());
14606 setClass(field[4].asUint8());
14607 setGender(field[5].asUint8());
14608 uint32_t cfaction = field[6].asUint32();
14609
14610 // set race dbc
14611 m_dbcRace = sChrRacesStore.lookupEntry(getRace());
14612 m_dbcClass = sChrClassesStore.lookupEntry(getClass());
14613 if (!m_dbcClass || !m_dbcRace)
14614 {
14615 // bad character
14616 sLogger.failure("guid {} failed to login, no race or class dbc found. (race {} class {})", getGuidLow(), (unsigned int)getRace(), (unsigned int)getClass());
14618 return;
14619 }
14620
14621 if (m_dbcRace->team_id == 7)
14622 m_bgTeam = m_team = 0;
14623 else
14624 m_bgTeam = m_team = 1;
14625
14627
14628 // set power type
14629 setPowerType(static_cast<uint8_t>(m_dbcClass->power_type));
14630
14631 // obtain player create m_playerCreateInfo
14632 m_playerCreateInfo = sMySQLStore.getPlayerCreateInfo(getRace(), getClass());
14633 if (m_playerCreateInfo == nullptr)
14634 {
14635 sLogger.failure("player guid {} has no playerCreateInfo!", getGuidLow());
14637 return;
14638 }
14639
14640 // set level
14641 setLevel(field[7].asUint32());
14642
14643 // obtain level/stats information
14644 m_levelInfo = sObjectMgr.getLevelInfo(getRace(), getClass(), getLevel());
14645
14646 if (!m_levelInfo)
14647 {
14648 sLogger.failure("guid {} level {} class {} race {} levelinfo not found!", getGuidLow(), getLevel(), (unsigned int)getClass(), (unsigned int)getRace());
14650 return;
14651 }
14652
14653#if VERSION_STRING > TBC
14654 // load achievements before anything else otherwise skills would complete achievements already in the DB, leading to duplicate achievements and criterias(like achievement=126).
14655 m_achievementMgr->loadFromDb(results[PlayerQuery::Achievements].result.get(), results[PlayerQuery::AchievementProgress].result.get());
14656#endif
14657
14659
14660 // set xp
14661 setXp(field[8].asUint32());
14662
14663 // Load active cheats
14664 uint32_t active_cheats = field[9].asUint32();
14665 if (active_cheats & PLAYER_CHEAT_COOLDOWN)
14667 if (active_cheats & PLAYER_CHEAT_CAST_TIME)
14669 if (active_cheats & PLAYER_CHEAT_GOD_MODE)
14671 if (active_cheats & PLAYER_CHEAT_POWER)
14672 m_cheats.hasPowerCheat = true;
14673 if (active_cheats & PLAYER_CHEAT_FLY)
14674 m_cheats.hasFlyCheat = true;
14675 if (active_cheats & PLAYER_CHEAT_AURA_STACK)
14677 if (active_cheats & PLAYER_CHEAT_ITEM_STACK)
14679 if (active_cheats & PLAYER_CHEAT_TRIGGERPASS)
14681 if (active_cheats & PLAYER_CHEAT_TAXI)
14682 m_cheats.hasTaxiCheat = true;
14683
14684 // Process exploration data.
14686
14687 loadSkills(results[PlayerQuery::Skills].result.get());
14688
14689 if (m_firstLogin || m_skills.empty())
14690 {
14691 // no skills - reset to defaults
14693 }
14694
14695#if VERSION_STRING >= Cata
14697#endif
14698
14699 // set the rest of the stuff
14700 setWatchedFaction(field[11].asUint32());
14701#if VERSION_STRING > Classic
14702 setChosenTitle(field[12].asUint32());
14703 setKnownTitles(0, field[13].asUint64());
14704#if VERSION_STRING > TBC
14705 setKnownTitles(1, field[14].asUint64());
14706 setKnownTitles(2, field[15].asUint64());
14707#endif
14708#endif
14709
14710 setCoinage(field[16].asUint32());
14711
14712#if VERSION_STRING < Cata
14713 setAmmoId(field[17].asUint32());
14714#endif
14715
14716 setFreePrimaryProfessionPoints(field[18].asUint32());
14717
14718 m_loadHealth = field[19].asUint32();
14719 m_loadMana = field[20].asUint32();
14721
14722 sLogger.debug("Player level {}, health {}, mana {} loaded from db!", getLevel(), m_loadHealth, m_loadMana);
14723
14724 setPvpRank(field[21].asUint8());
14725
14726 setPlayerBytes(field[22].asUint32());
14727 setPlayerBytes2(field[23].asUint32());
14728
14730
14731 setPlayerFlags(field[24].asUint32());
14732 setEnabledActionBars(field[25].asUint8());
14733
14734 m_position.x = field[26].asFloat();
14735 m_position.y = field[27].asFloat();
14736 m_position.z = field[28].asFloat();
14737 m_position.o = field[29].asFloat();
14738
14739 m_mapId = field[30].asUint32();
14740 m_zoneId = field[31].asUint32();
14742
14743 // Initialize 'normal' fields
14744 setScale(1.0f);
14745#if VERSION_STRING > TBC
14746 setHoverHeight(1.0f);
14747#endif
14748
14749 setBoundingRadius(0.388999998569489f);
14750 setCombatReach(1.5f);
14751
14753
14755
14756 if (const auto raceEntry = sChrRacesStore.lookupEntry(getRace()))
14757 setFaction(raceEntry->faction_id);
14758 else
14759 setFaction(0);
14760
14761 if (cfaction)
14762 {
14763 setFaction(cfaction);
14764 // re-calculate team
14765 switch (cfaction)
14766 {
14767 case 1: // human
14768 case 3: // dwarf
14769 case 4: // ne
14770 case 8: // gnome
14771 case 927: // draenei
14772 m_team = m_bgTeam = 0;
14773 break;
14774 case 2: // orc
14775 case 5: // undead
14776 case 6: // tauren
14777 case 9: // troll
14778 case 914: // bloodelf
14779 m_team = m_bgTeam = 1;
14780 break;
14781 }
14782 }
14783
14784 // Load Taxis From Database
14785 m_taxi->loadTaxiMask(field[32].asCString());
14787
14788 m_banned = field[33].asUint32(); //Character ban
14789 m_banreason = field[34].asCString();
14790 m_timeLogoff = field[35].asUint32();
14791 //field[36].GetUInt32(); online
14792
14793 setBindPoint(field[37].asFloat(), field[38].asFloat(), field[39].asFloat(), field[40].asFloat(), field[41].asUint32(), field[42].asUint32());
14794
14795 m_isResting = field[43].asUint8();
14796 m_restState = field[44].asUint8();
14797 m_restAmount = field[45].asUint32();
14798
14799
14800 std::string tmpStr = field[46].asCString();
14801 m_playedTime[0] = (uint32_t)atoi(strtok((char*)tmpStr.c_str(), " "));
14802 m_playedTime[1] = (uint32_t)atoi(strtok(nullptr, " "));
14803
14804 m_deathState = (DeathState)field[47].asUint32();
14805 m_talentResetsCount = field[48].asUint32();
14806 m_firstLogin = field[49].asBool();
14807 m_loginFlag = field[50].asUint32();
14808 m_arenaPoints = field[51].asUint32();
14809 if (m_arenaPoints > worldConfig.limit.maxArenaPoints)
14810 {
14811 std::stringstream dmgLog;
14812 dmgLog << "has over " << worldConfig.limit.maxArenaPoints << " arena points " << m_arenaPoints;
14813 sCheatLog.writefromsession(m_session, dmgLog.str().c_str());
14814
14815 if (worldConfig.limit.broadcastMessageToGmOnExceeding) // report to online GMs
14816 sendReportToGmMessage(getName(), dmgLog.str());
14817
14818 if (worldConfig.limit.disconnectPlayerForExceedingLimits)
14819 {
14821 }
14822 m_arenaPoints = worldConfig.limit.maxArenaPoints;
14823 }
14824
14826
14828
14829 m_stableSlotCount = static_cast<uint8_t>(field[52].asUint32());
14830 m_instanceId = field[53].asUint32();
14831
14832 setBGEntryPoint(field[55].asFloat(), field[56].asFloat(), field[57].asFloat(), field[58].asFloat(), field[54].asUint32(), field[59].asUint32());
14833
14834 std::string taxi_nodes = field[60].asCString();
14835 uint32_t taxi_currentNode = field[61].asInt32();
14836
14837 uint32_t transportGuid = field[62].asUint32();
14838 float transportX = field[63].asFloat();
14839 float transportY = field[64].asFloat();
14840 float transportZ = field[65].asFloat();
14841 float transportO = field[66].asFloat();
14842
14843 if (transportGuid != 0)
14844 obj_movement_info.setTransportData(transportGuid, transportX, transportY, transportZ, transportO, 0, 0);
14845 else
14847
14848 loadDeletedSpells(results[PlayerQuery::DeletedSpells].result.get());
14849
14850 loadSpells(results[PlayerQuery::Spells].result.get());
14851
14852 loadReputations(results[PlayerQuery::Reputation].result.get());
14853
14854 // Load saved actionbars
14855 uint32_t Counter = 0;
14856 char* start = nullptr;
14857 char* end = nullptr;
14858#if VERSION_STRING > TBC
14859 for (uint8_t s = 0; s < MAX_SPEC_COUNT; ++s)
14860 {
14861 start = (char*)field[67 + s].asCString();
14862 Counter = 0;
14863 while (Counter < PLAYER_ACTION_BUTTON_COUNT)
14864 {
14865 if (start == nullptr)
14866 break;
14867
14868 end = strchr(start, ',');
14869 if (!end)
14870 break;
14871 *end = 0;
14872 m_specs[0 + s].getActionButton(Counter).Action = std::stoul(start);
14873 start = end + 1;
14874 end = strchr(start, ',');
14875 if (!end)
14876 break;
14877 *end = 0;
14878 m_specs[0 + s].getActionButton(Counter).Type = static_cast<uint8_t>(std::stoul(start));
14879 start = end + 1;
14880 end = strchr(start, ',');
14881 if (!end)
14882 break;
14883 *end = 0;
14884 m_specs[0 + s].getActionButton(Counter).Misc = static_cast<uint8_t>(std::stoul(start));
14885 start = end + 1;
14886
14887 Counter++;
14888 }
14889 }
14890#else
14891 {
14892 auto& spec = m_spec;
14893
14894 start = (char*)field[67].asCString();
14895 Counter = 0;
14896 while (Counter < PLAYER_ACTION_BUTTON_COUNT)
14897 {
14898 if (start == nullptr)
14899 break;
14900
14901 end = strchr(start, ',');
14902 if (!end)
14903 break;
14904 *end = 0;
14905 spec.getActionButton(Counter).Action = (uint32_t)std::stoul(start);
14906 start = end + 1;
14907 end = strchr(start, ',');
14908 if (!end)
14909 break;
14910 *end = 0;
14911 spec.getActionButton(Counter).Type = (uint8_t)std::stoul(start);
14912 start = end + 1;
14913 end = strchr(start, ',');
14914 if (!end)
14915 break;
14916 *end = 0;
14917 spec.getActionButton(Counter).Misc = (uint8_t)std::stoul(start);
14918 start = end + 1;
14919
14920 Counter++;
14921 }
14922 }
14923#endif
14924
14925 if (m_firstLogin)
14926 {
14927 for (const auto itr : m_playerCreateInfo->actionbars)
14928 setActionButton(itr.button, itr.action, itr.type, itr.misc);
14929 }
14930
14931 //////////////////////////////////////////////////////////////////////////////////////////
14932 // Parse saved buffs
14933 std::istringstream savedPlayerBuffsStream(field[69].asCString());
14934 std::string auraId, auraDuration, auraPositivValue, auraCharges;
14935
14936 while (std::getline(savedPlayerBuffsStream, auraId, ','))
14937 {
14938 LoginAura la;
14939 la.id = std::stoul(auraId.c_str());
14940
14941 std::getline(savedPlayerBuffsStream, auraDuration, ',');
14942 la.dur = std::stoul(auraDuration.c_str());
14943
14944 std::getline(savedPlayerBuffsStream, auraPositivValue, ',');
14945 la.positive = auraPositivValue.empty() ? false : true;
14946
14947 std::getline(savedPlayerBuffsStream, auraCharges, ',');
14948 la.charges = std::stoul(auraCharges.c_str());
14949
14950 m_loginAuras.push_back(la);
14951 }
14952
14953 // Load saved finished quests
14954
14955 start = (char*)field[70].asCString();
14956 while (true)
14957 {
14958 end = strchr(start, ',');
14959 if (!end)break;
14960 *end = 0;
14961 const uint32_t questEntry = std::stoul(start);
14962 m_finishedQuests.insert(questEntry);
14963
14964 // Load talent points from finished quests
14965 auto questProperties = sMySQLStore.getQuestProperties(questEntry);
14966 if (questProperties != nullptr && questProperties->rewardtalents > 0)
14967 m_talentPointsFromQuests += questProperties->rewardtalents;
14968
14969 start = end + 1;
14970 }
14971
14972 start = (char*)field[71].asCString();
14973 while (true)
14974 {
14975 end = strchr(start, ',');
14976 if (!end) break;
14977 *end = 0;
14978 m_finishedDailies.insert(std::stoul(start));
14979 start = end + 1;
14980 }
14981
14982 m_honorRolloverTime = field[72].asUint32();
14983 m_killsToday = field[73].asUint32();
14984 m_killsYesterday = field[74].asUint32();
14985 m_killsLifetime = field[75].asUint32();
14986
14987 m_honorToday = field[76].asUint32();
14988 m_honorYesterday = field[77].asUint32();
14989 m_honorPoints = field[78].asUint32();
14990 if (m_honorPoints > worldConfig.limit.maxHonorPoints)
14991 {
14992 std::stringstream dmgLog;
14993 dmgLog << "has over " << worldConfig.limit.maxHonorPoints << " honor points " << m_honorPoints;
14994
14995 sCheatLog.writefromsession(m_session, dmgLog.str().c_str());
14996
14997 if (worldConfig.limit.broadcastMessageToGmOnExceeding)
14998 sendReportToGmMessage(getName(), dmgLog.str());
14999
15000 if (worldConfig.limit.disconnectPlayerForExceedingLimits)
15002
15003 m_honorPoints = worldConfig.limit.maxHonorPoints;
15004 }
15005
15006 rolloverHonor();
15007
15008 // Load drunk value and calculate sobering. after 15 minutes logged out, the player will be sober again
15009 uint32_t timediff = (uint32_t)UNIXTIME - m_timeLogoff;
15010 uint32_t soberFactor;
15011 if (timediff > 900)
15012 soberFactor = 0;
15013 else
15014 soberFactor = 1 - timediff / 900;
15015
15016 setServersideDrunkValue(uint16_t(soberFactor * field[79].asUint32()));
15017
15018#if VERSION_STRING > TBC
15019 for (uint8_t s = 0; s < MAX_SPEC_COUNT; ++s)
15020 {
15021 start = (char*)field[80 + 2 * s].asCString();
15022 uint8_t glyphid = 0;
15023 while (glyphid < GLYPHS_COUNT)
15024 {
15025 end = strchr(start, ',');
15026 if (!end)break;
15027 *end = 0;
15028 m_specs[s].setGlyph(static_cast<uint16_t>(std::stoul(start)), glyphid);
15029 ++glyphid;
15030 start = end + 1;
15031 }
15032
15033 //Load talents for spec
15034 start = (char*)field[81 + 2 * s].asCString();
15035 while (end != nullptr)
15036 {
15037 end = strchr(start, ',');
15038 if (!end)
15039 break;
15040 *end = 0;
15041 uint32_t talentid = std::stoul(start);
15042 start = end + 1;
15043
15044 end = strchr(start, ',');
15045 if (!end)
15046 break;
15047 *end = 0;
15048 uint8_t rank = static_cast<uint8_t>(std::stoul(start));
15049 start = end + 1;
15050
15051 m_specs[s].addTalent(talentid, rank);
15052 }
15053 }
15054#else
15055 {
15056 auto& spec = m_spec;
15057
15058 //Load talents for spec
15059 start = (char*)field[81].asCString(); // talents1
15060 while (end != nullptr)
15061 {
15062 end = strchr(start, ',');
15063 if (!end)
15064 break;
15065 *end = 0;
15066 uint32_t talentid = std::stoul(start);
15067 start = end + 1;
15068
15069 end = strchr(start, ',');
15070 if (!end)
15071 break;
15072 *end = 0;
15073 uint8_t rank = static_cast<uint8_t>(std::stoul(start));
15074 start = end + 1;
15075
15076 spec.addTalent(talentid, rank);
15077 }
15078 }
15079#endif
15080
15081 m_talentSpecsCount = field[84].asUint8();
15082 m_talentActiveSpec = field[85].asUint8();
15083
15084#if VERSION_STRING > TBC
15085 {
15086 if (auto talentPoints = field[86].asCString())
15087 {
15088 uint32_t tps[2] = { 0,0 };
15089
15090 auto talentPointsVector = AscEmu::Util::Strings::split(talentPoints, " ");
15091 for (uint8_t i = 0; i < 2; ++i)
15092 tps[i] = std::stoi(talentPointsVector[i]);
15093
15094 m_specs[SPEC_PRIMARY].setTalentPoints(tps[0]);
15095 m_specs[SPEC_SECONDARY].setTalentPoints(tps[1]);
15096 }
15097#if VERSION_STRING < Cata
15098 setFreeTalentPoints(getActiveSpec().getTalentPoints());
15099#endif
15100 }
15101#else
15102 {
15103 if (auto talentPoints = field[86].asCString())
15104 {
15105 uint32_t tps[2] = { 0,0 };
15106
15107 auto talentPointsVector = AscEmu::Util::Strings::split(talentPoints, " ");
15108 for (uint8_t i = 0; i < 2; ++i)
15109 tps[i] = std::stoi(talentPointsVector[i]);
15110
15111 m_spec.setTalentPoints(tps[0]);
15112 }
15113
15114 setFreeTalentPoints(getActiveSpec().getTalentPoints());
15115 }
15116#endif
15117
15118#if VERSION_STRING >= Cata
15119 m_FirstTalentTreeLock = field[87].asUint32(); // Load First Set Talent Tree
15120#endif
15121
15122 m_phase = field[88].asUint32(); //Load the player's last phase
15123
15124 uint32_t xpfield = field[89].asUint32();
15125
15126 if (xpfield == 0)
15127 m_isXpGainAllowed = false;
15128 else
15129 m_isXpGainAllowed = true;
15130
15131 //field[90].GetString(); //skipping data
15132
15133 if (field[91].asUint32() == 1)
15134 m_resetTalents = true;
15135 else
15136 m_resetTalents = false;
15137
15138 // Load player's RGB daily data
15139 if (field[92].asUint32() == 1)
15140 m_hasWonRbgToday = true;
15141 else
15142 m_hasWonRbgToday = false;
15143
15144 m_dungeonDifficulty = field[93].asUint8();
15145 m_raidDifficulty = field[94].asUint8();
15146
15148
15149#if VERSION_STRING > TBC
15150 updateGlyphs();
15151
15152 for (uint8_t i = 0; i < GLYPHS_COUNT; ++i)
15153 setGlyph(i, m_specs[m_talentActiveSpec].getGlyph(i));
15154#endif
15155
15156 //class fixes
15157 switch (getClass())
15158 {
15159 case WARLOCK:
15160 case HUNTER:
15161#if VERSION_STRING >= WotLK
15162 case DEATHKNIGHT:
15163 case MAGE:
15164#endif
15165 _loadPet(results[PlayerQuery::Pets].result.get());
15166 _loadPetSpells(results[PlayerQuery::SummonSpells].result.get());
15167 break;
15168 }
15169
15170 if (getGuildId())
15171 setGuildTimestamp(static_cast<uint32_t>(UNIXTIME));
15172
15173 // load properties
15174 loadTutorials();
15175 _loadPlayerCooldowns(results[PlayerQuery::Cooldowns].result.get());
15176 _loadQuestLogEntry(results[PlayerQuery::Questlog].result.get());
15179
15180#if VERSION_STRING > WotLK
15181 loadVoidStorage();
15182#endif
15183
15184 m_mailBox->Load(results[PlayerQuery::Mailbox].result.get());
15185
15186 // Saved Instances
15189
15190 // Create Instance when needed
15191 if (sMapMgr.findBaseMap(GetMapId()) && sMapMgr.findBaseMap(GetMapId())->isInstanceableMap())
15192 {
15193 // No Instance Found Lets Create it
15194 if (!sMapMgr.findWorldMap(GetMapId(), GetInstanceID()))
15195 sMapMgr.createInstanceForPlayer(GetMapId(), this, GetInstanceID());
15196 }
15197
15198 // SOCIAL
15202 // END SOCIAL
15203
15204 // Check skills that player shouldn't have
15207
15208#if VERSION_STRING > TBC
15209 // update achievements before adding player to World, otherwise we'll get a nice race condition.
15210 //move CheckAllAchievementCriteria() after FullLogin(this) and i'll cut your b***s.
15211 m_achievementMgr->updateAllAchievementCriteria();
15212#endif
15213
15214 m_session->fullLogin(this);
15215 m_session->m_loggingInPlayer = nullptr;
15216
15217 if (!isAlive())
15218 {
15219 if (const auto corpse = sObjectMgr.getCorpseByOwner(getGuidLow()))
15220 setCorpseData(corpse->GetPosition(), corpse->GetInstanceID());
15221 }
15222
15223#if VERSION_STRING > Classic
15224 uint32_t uniques[64];
15225 int nuniques = 0;
15226
15228 {
15230 Item* it = itemi->GetInventoryItem(x);
15231
15232 if (it != nullptr)
15233 {
15234 for (uint8_t count = 0; count < it->getSocketSlotCount(); count++)
15235 {
15236 const auto enchantmentSlot = static_cast<EnchantmentSlot>(SOCK_ENCHANTMENT_SLOT1 + count);
15237 EnchantmentInstance* ei = it->getEnchantment(enchantmentSlot);
15238
15239 if (ei && ei->Enchantment)
15240 {
15241 ItemProperties const* ip = sMySQLStore.getItemProperties(ei->Enchantment->GemEntry);
15242
15243 if (ip && ip->Flags & ITEM_FLAG_UNIQUE_EQUIP &&
15244 itemi->IsEquipped(ip->ItemId))
15245 {
15246 int i;
15247
15248 for (i = 0; i < nuniques; i++)
15249 {
15250 if (uniques[i] == ip->ItemId)
15251 {
15252 // found a duplicate unique-equipped gem, remove it
15253 it->removeEnchantment(enchantmentSlot);
15254 break;
15255 }
15256 }
15257
15258 if (i == nuniques) // not found
15259 uniques[nuniques++] = ip->ItemId;
15260 }
15261 }
15262 }
15263 }
15264 }
15265#endif
15266
15267 // Continue Our Taxi Path
15268 if (!taxi_nodes.empty())
15269 {
15270 // Not finish taxi flight path
15271 if (!m_taxi->loadTaxiDestinationsFromString(taxi_nodes, GetTeam()))
15272 {
15273 // problems with taxi path loading
15274 WDB::Structures::TaxiNodesEntry const* nodeEntry = nullptr;
15275 if (uint32_t node_id = m_taxi->getTaxiSource())
15276 nodeEntry = sTaxiNodesStore.lookupEntry(node_id);
15277
15278 if (!nodeEntry) // don't know taxi start node, teleport to homebind
15279 {
15281 }
15282 else // has start node, teleport to it
15283 {
15284 safeTeleport(nodeEntry->mapid, 0, LocationVector(nodeEntry->x, nodeEntry->y, nodeEntry->z, 0.0f));
15285 }
15286 m_taxi->clearTaxiDestinations();
15287 }
15288
15289 m_taxi->setNodeAfterTeleport(taxi_currentNode);
15290 // flight will started later
15291 }
15292
15293 auto timeToNow = Util::GetTimeDifferenceToNow(startTime);
15294 sLogger.info("Time for playerloading: {} ms", static_cast<uint32_t>(timeToNow));
15295}
@ ITEM_FLAG_UNIQUE_EQUIP
@ EQUIPMENT_SLOT_START
EnchantmentSlot
@ SOCK_ENCHANTMENT_SLOT1
@ PLAYER_CHEAT_CAST_TIME
@ PLAYER_CHEAT_AURA_STACK
@ PLAYER_CHEAT_FLY
@ PLAYER_CHEAT_POWER
@ PLAYER_CHEAT_ITEM_STACK
@ PLAYER_CHEAT_COOLDOWN
@ PLAYER_CHEAT_TAXI
@ PLAYER_CHEAT_TRIGGERPASS
@ PLAYER_CHEAT_GOD_MODE
#define PLAYER_ACTION_BUTTON_COUNT
DeathState
bool LoadfromDB(QueryResult *result)
static void RecalculateHonorFields(Player *pPlayer)
void mLoadItemsFromDatabase(QueryResult *result)
Item Loading.
Arcemu::EquipmentSetMgr m_EquipmentSets
bool IsEquipped(uint32_t itemid)
void removeEnchantment(EnchantmentSlot slot, bool timerExpired=false)
Definition Item.cpp:362
uint8_t getSocketSlotCount(bool includePrismatic=true) const
Definition Item.cpp:824
EnchantmentInstance * getEnchantment(EnchantmentSlot slot)
Definition Item.cpp:252
void setScale(float scaleX)
Definition Object.cpp:408
uint32_t m_phase
Definition Object.hpp:634
int32_t m_instanceId
Definition Object.hpp:757
void setTalentPoints(uint32_t points)
void initialiseArenaTeam()
Definition Player.cpp:8073
void setGuildTimestamp(uint32_t timestamp)
Definition Player.cpp:874
bool loadSpells(QueryResult *result)
Definition Player.cpp:3846
void loadIgnoreList()
Definition Player.cpp:9105
void loadFriendList()
Definition Player.cpp:9072
void loadBoundInstances()
Definition Player.cpp:12729
void setGlyph(uint16_t slot, uint32_t glyph)
Definition Player.cpp:1310
uint32_t m_timeLogoff
Definition Player.hpp:745
void setPvpRank(uint8_t rank)
Definition Player.cpp:862
bool loadSkills(QueryResult *result)
Definition Player.cpp:3872
uint32_t m_honorRolloverTime
Definition Player.hpp:1385
bool loadReputations(QueryResult *result)
Definition Player.cpp:3891
void _loadPet(QueryResult *result)
Definition Player.cpp:14017
void learnInitialSkills()
Definition Player.cpp:4956
void setPlayerBytes(uint32_t bytes)
Definition Player.cpp:822
uint8_t m_talentSpecsCount
Definition Player.hpp:1987
void rolloverHonor()
Definition Player.cpp:8178
void setInitialPlayerProfessions()
Definition Player.cpp:5201
void loadFieldsFromString(const char *string, uint16_t firstField, uint32_t fieldsNum)
Definition Player.cpp:13174
void _loadQuestLogEntry(QueryResult *result)
Definition Player.cpp:15297
void setBGEntryPoint(float x, float y, float z, float o, uint32_t mapId, int32_t instanceId)
Definition Player.cpp:7822
void initialiseCharters()
Definition Player.cpp:7855
void loadInstanceTimeRestrictions()
Definition Player.cpp:13106
bool loadDeletedSpells(QueryResult *result)
Definition Player.cpp:13427
void setInitialPlayerData()
Definition Player.cpp:3616
bool m_resetTalents
Definition Player.hpp:1013
void setActionButton(uint8_t button, uint32_t action, uint8_t type, uint8_t misc)
Definition Player.cpp:6374
void _loadPlayerCooldowns(QueryResult *result)
Definition Player.cpp:4627
void setEnabledActionBars(uint8_t actionBarId)
Definition Player.cpp:1235
void removePendingPlayer()
Definition Player.cpp:3134
void _loadPetSpells(QueryResult *result)
Definition Player.cpp:14118
void setCorpseData(LocationVector position, int32_t instanceId)
Definition Player.cpp:7419
void loadTutorials()
Definition Player.cpp:6350
void loadFriendedByOthersList()
Definition Player.cpp:9090
uint32_t GetFieldCount() const
Definition Database.h:196
void setCombatReach(float radius)
Definition Unit.cpp:1250
DeathState m_deathState
Definition Unit.hpp:1117
void setHoverHeight(float height)
Definition Unit.cpp:1704
void setBoundingRadius(float radius)
Definition Unit.cpp:1247
void setPowerType(uint8_t powerType)
Definition Unit.cpp:463
Player * m_loggingInPlayer
uint32_t GetAccountId() const
void fullLogin(Player *player)
std::vector< std::string > split(const std::string &source, const std::string &seperator)
Seperates string by seperator (one char) returns string vecotr.
Definition Strings.cpp:39
@ AchievementProgress
Definition Player.cpp:14521
long long GetTimeDifferenceToNow(const std::chrono::high_resolution_clock::time_point &start_time)
Returns the difference between start_time and now in milliseconds.
Definition Util.cpp:150
std::chrono::high_resolution_clock::time_point TimeNow()
Returns the current point in time.
Definition Util.cpp:130
WDB::Structures::SpellItemEnchantmentEntry const * Enchantment
Definition Item.hpp:29
uint32_t charges
void clearTransportData()
void setTransportData(ObjectGuid _guid, float x, float y, float z, float o, uint32_t time, int8_t seat)
Here is the caller graph for this function:

◆ loadIgnoreList()

void Player::loadIgnoreList ( )

Definition at line 9105 of file Player.cpp.

9106{
9107 if (auto result = CharacterDatabase.Query("SELECT * FROM social_ignores WHERE character_guid = %u", getGuidLow()))
9108 {
9109 do
9110 {
9111 auto* const ignoreField = result->Fetch();
9112 uint32_t ignoreGuid = ignoreField[1].asUint32();
9113
9114 m_socialIgnoring.push_back(ignoreGuid);
9115
9116 } while (result->NextRow());
9117 }
9118}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadInstanceTimeRestrictions()

void Player::loadInstanceTimeRestrictions ( )

Definition at line 13106 of file Player.cpp.

13107{
13108 auto result = CharacterDatabase.Query("SELECT instanceId, releaseTime FROM account_instance_times WHERE accountId = %u", getSession()->GetAccountId());
13109 if (!result)
13110 return;
13111
13112 do
13113 {
13114 Field* fields = result->Fetch();
13115 m_instanceResetTimes.insert(InstanceTimeMap::value_type(fields[0].asUint32(), fields[1].asUint64()));
13116 } while (result->NextRow());
13117}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadReputations()

bool Player::loadReputations ( QueryResult result)

Definition at line 3891 of file Player.cpp.

3892{
3893 // Add initial reputations on first login
3894 if (m_firstLogin)
3895 {
3897 return true;
3898 }
3899
3900 if (result == nullptr)
3901 return false;
3902
3903 do
3904 {
3905 const auto field = result->Fetch();
3906
3907 const auto id = field[0].asUint32();
3908 const auto flag = field[1].asUint8();
3909 const auto basestanding = field[2].asInt32();
3910 const auto standing = field[3].asInt32();
3911
3912 const auto faction = sFactionStore.lookupEntry(id);
3913 if (faction == nullptr || faction->RepListId < 0)
3914 continue;
3915
3916 const auto [repItr, _] = m_reputation.insert_or_assign(id, std::make_unique<FactionReputation>(standing, flag, basestanding));
3917 m_reputationByListId[faction->RepListId] = repItr->second.get();
3918 } while (result->NextRow());
3919
3920 return true;
3921}
void initialiseReputation()
Definition Player.cpp:11803
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadSkills()

bool Player::loadSkills ( QueryResult result)

Definition at line 3872 of file Player.cpp.

3873{
3874 if (result == nullptr)
3875 return false;
3876
3877 do
3878 {
3879 const auto fields = result->Fetch();
3880
3881 const auto skillid = fields[0].asUint16();
3882 const auto currval = fields[1].asUint16();
3883 const auto maxval = fields[2].asUint16();
3884
3885 addSkillLine(skillid, currval, maxval);
3886 } while (result->NextRow());
3887
3888 return true;
3889}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadSpells()

bool Player::loadSpells ( QueryResult result)

Definition at line 3846 of file Player.cpp.

3847{
3848 // Add initial spells on first login
3849 if (m_firstLogin)
3850 {
3851 for (const auto& spellId : m_playerCreateInfo->spell_list)
3852 addSpell(spellId);
3853
3854 return true;
3855 }
3856
3857 if (result == nullptr)
3858 return false;
3859
3860 do
3861 {
3862 const auto fields = result->Fetch();
3863 const auto spellId = fields[0].asUint32();
3864
3865 // addSpell will validate spell id
3866 addSpell(spellId);
3867 } while (result->NextRow());
3868
3869 return true;
3870}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadTutorials()

void Player::loadTutorials ( )

Definition at line 6350 of file Player.cpp.

6351{
6352 if (auto result = CharacterDatabase.Query("SELECT * FROM tutorials WHERE playerId = %u", getGuidLow()))
6353 {
6354 auto* const fields = result->Fetch();
6355 for (uint8_t id = 0; id < 8; ++id)
6356 m_tutorials[id] = fields[id + 1].asUint32();
6357 }
6358 m_tutorialsDirty = false;
6359}
bool m_tutorialsDirty
Definition Player.hpp:1026
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logIntoBattleground()

void Player::logIntoBattleground ( )

Definition at line 9402 of file Player.cpp.

9403{
9404 const auto mapMgr = sMapMgr.findWorldMap(GetMapId(), GetInstanceID());
9405 if (mapMgr && mapMgr->getBaseMap()->isBattlegroundOrArena())
9406 {
9407 const auto battleground = reinterpret_cast<BattlegroundMap*>(mapMgr)->getBattleground();
9408 if (battleground->hasEnded() && battleground->hasFreeSlots(getInitialTeam(), battleground->getType()))
9409 {
9411 {
9414 }
9415 else
9416 {
9419 }
9420 }
9421 }
9422}
Battleground * getBattleground() const
Definition Player.cpp:8546
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logOntoTransport()

bool Player::logOntoTransport ( )

Definition at line 9424 of file Player.cpp.

9425{
9426 bool success = true;
9428 {
9430 if (transporter)
9431 {
9432 if (isDead())
9433 {
9434 resurrect();
9437 }
9438
9439 const float c_tposx = transporter->GetPositionX() + GetTransOffsetX();
9440 const float c_tposy = transporter->GetPositionY() + GetTransOffsetY();
9441 const float c_tposz = transporter->GetPositionZ() + GetTransOffsetZ();
9442
9443 const LocationVector positionOnTransport = LocationVector(c_tposx, c_tposy, c_tposz, GetOrientation());
9444
9445 if (GetMapId() != transporter->GetMapId())
9446 {
9447 SetMapId(transporter->GetMapId());
9448 sendPacket(AscEmu::Packets::SmsgNewWorld(transporter->GetMapId(), positionOnTransport).serialise().get());
9449
9450 success = false;
9451 }
9452
9453 SetPosition(positionOnTransport.x, positionOnTransport.y, positionOnTransport.z, positionOnTransport.o, false);
9454 transporter->AddPassenger(this);
9455 }
9456 }
9457
9458 return success;
9459}
#define sTransportHandler
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modCoinage()

void Player::modCoinage ( int64_t  coinage)

Definition at line 1187 of file Player.cpp.

1188{
1189 setCoinage(getCoinage() + coinage);
1190}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modCombatRating()

void Player::modCombatRating ( uint8_t  combatRating,
int32_t  value 
)

Definition at line 1278 of file Player.cpp.

1278{ setCombatRating(combatRating, getCombatRating(combatRating) + value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modExpertise()

void Player::modExpertise ( int32_t  value)

Definition at line 1093 of file Player.cpp.

uint32_t getExpertise() const
Definition Player.cpp:1091
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modFactionStanding()

void Player::modFactionStanding ( uint32_t  faction,
int32_t  value 
)

Definition at line 11448 of file Player.cpp.

11449{
11450 WDB::Structures::FactionEntry const* factionEntry = sFactionStore.lookupEntry(faction);
11451 if (factionEntry == nullptr || factionEntry->RepListId < 0)
11452 return;
11453
11454 const int32_t minReputation = -42000; // 0/36000 Hated
11455 const int32_t exaltedReputation = 42000; // 0/1000 Exalted
11456 const int32_t maxReputation = 42999; // 999/1000 Exalted
11457
11458 if ((getWorldMap()->getBaseMap()->getMapInfo()->minlevel == 80 ||
11459 (getWorldMap()->getDifficulty() == InstanceDifficulty::DUNGEON_HEROIC && getWorldMap()->getBaseMap()->getMapInfo()->minlevel_heroic == 80)) &&
11461 faction = m_championingFactionId;
11462
11463 int32_t newValue = value;
11464 if (newValue < minReputation)
11465 newValue = minReputation;
11466 else if (newValue > maxReputation)
11467 newValue = maxReputation;
11468
11469 ReputationMap::iterator itr = m_reputation.find(faction);
11470 if (itr == m_reputation.end())
11471 {
11472 if (!addNewFaction(factionEntry, newValue, false))
11473 return;
11474
11475 itr = m_reputation.find(faction);
11476
11477#if VERSION_STRING > TBC
11478 if (itr->second->standing >= 42000)
11479 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, 1, 0, 0);
11480
11481 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID, itr->second->standing, 0);
11482#endif
11483
11485 onModStanding(factionEntry, itr->second.get());
11486 }
11487 else
11488 {
11489 if (m_pctReputationMod > 0)
11490 newValue = value + (value * m_pctReputationMod / 100);
11491
11492 if (RankChanged(itr->second->standing, newValue))
11493 {
11494 itr->second->standing += newValue;
11496
11497#if VERSION_STRING > TBC
11498 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID, itr->second->standing, 0);
11499 if (itr->second->standing >= exaltedReputation)
11500 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, 1, 0, 0);
11501 else if (itr->second->standing - newValue >= exaltedReputation)
11502 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, -1, 0, 0);
11503#endif
11504
11505 }
11506 else
11507 {
11508 itr->second->standing += newValue;
11509 }
11510
11511 if (itr->second->standing < minReputation)
11512 itr->second->standing = minReputation;
11513 else if (itr->second->standing > maxReputation)
11514 itr->second->standing = maxReputation;
11515 onModStanding(factionEntry, itr->second.get());
11516 }
11517}
bool RankChanged(int32_t Standing, int32_t Change)
Definition Player.cpp:11359
void updateInrangeSetsBasedOnReputation()
Definition Player.cpp:11610
uint32_t m_championingFactionId
Definition Player.hpp:1694
void onModStanding(WDB::Structures::FactionEntry const *factionEntry, FactionReputation *reputation)
Definition Player.cpp:11733
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modFreePrimaryProfessionPoints()

void Player::modFreePrimaryProfessionPoints ( int32_t  amount)

Definition at line 1064 of file Player.cpp.

1065{
1067 value += amount;
1068
1069 if (value < 0)
1070 value = 0;
1071
1073}
uint32_t getFreePrimaryProfessionPoints() const
Definition Player.cpp:1043
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modifyBonuses()

void Player::modifyBonuses ( uint32_t  type,
int32_t  val,
bool  apply 
)

Definition at line 16317 of file Player.cpp.

16318{
16319 // Added some updateXXXX calls so when an item modifies a stat they get updated
16320 // also since this is used by auras now it will handle it for those
16321 int32_t _val = val;
16322 if (!apply)
16323 val = -val;
16324
16325 switch (type)
16326 {
16327 case ITEM_MOD_MANA:
16328 {
16330 m_manaFromItems += val;
16331 }
16332 break;
16333 case ITEM_MOD_HEALTH:
16334 {
16335 modMaxHealth(val);
16336 m_healthFromItems += val;
16337 }
16338 break;
16339 case ITEM_MOD_AGILITY: // modify agility
16340 case ITEM_MOD_STRENGTH: // modify strength
16341 case ITEM_MOD_INTELLECT: // modify intellect
16342 case ITEM_MOD_SPIRIT: // modify spirit
16343 case ITEM_MOD_STAMINA: // modify stamina
16344 {
16345 uint8_t convert[] = { 1, 0, 3, 4, 2 };
16346 if (_val > 0)
16347 m_flatStatModPos[convert[type - 3]] += val;
16348 else
16349 m_flatStatModNeg[convert[type - 3]] -= val;
16350 calcStat(convert[type - 3]);
16351 }
16352 break;
16354 {
16356 modCombatRating(CR_WEAPON_SKILL_MAINHAND, val); // melee main hand
16357 modCombatRating(CR_WEAPON_SKILL_OFFHAND, val); // melee off hand
16358 }
16359 break;
16361 {
16363 }
16364 break;
16366 {
16368 }
16369 break;
16371 {
16373 }
16374 break;
16376 {
16378 }
16379 break;
16381 {
16383 }
16384 break;
16386 {
16388 }
16389 break;
16391 {
16393 }
16394 break;
16396 {
16398 }
16399 break;
16401 {
16403 }
16404 break;
16406 {
16408 }
16409 break;
16411 {
16413 }
16414 break;
16416 {
16418 }
16419 break;
16421 {
16423 }
16424 break;
16426 {
16427
16428 } break;
16430 {
16431
16432 } break;
16434 {
16435
16436 } break;
16438 {
16439 modCombatRating(CR_HASTE_MELEE, val); // melee
16440 }
16441 break;
16443 {
16444 modCombatRating(CR_HASTE_RANGED, val); // ranged
16445 }
16446 break;
16448 {
16449 modCombatRating(CR_HASTE_SPELL, val); // spell
16450 }
16451 break;
16453 {
16454 modCombatRating(CR_HIT_MELEE, val); // melee
16455 modCombatRating(CR_HIT_RANGED, val); // ranged
16456 modCombatRating(CR_HIT_SPELL, val); // spell
16457 }
16458 break;
16460 {
16461 modCombatRating(CR_CRIT_MELEE, val); // melee
16462 modCombatRating(CR_CRIT_RANGED, val); // ranged
16463 modCombatRating(CR_CRIT_SPELL, val); // spell
16464 }
16465 break;
16466 case ITEM_MOD_HIT_AVOIDANCE_RATING: // this is guessed based on layout of other fields
16467 {
16468 modCombatRating(CR_HIT_TAKEN_MELEE, val); // melee
16469 modCombatRating(CR_HIT_TAKEN_RANGED, val); // ranged
16470 modCombatRating(CR_HIT_TAKEN_SPELL, val); // spell
16471 }
16472 break;
16474 {
16475
16476 } break;
16478 {
16480 }
16481 break;
16483 {
16484#if VERSION_STRING >= Cata
16487#else
16488 modCombatRating(CR_CRIT_TAKEN_MELEE, val); // melee
16489 modCombatRating(CR_CRIT_TAKEN_RANGED, val); // ranged
16490#endif
16491 modCombatRating(CR_CRIT_TAKEN_SPELL, val); // spell
16492 }
16493 break;
16495 {
16496 modCombatRating(CR_HASTE_MELEE, val); // melee
16497 modCombatRating(CR_HASTE_RANGED, val); // ranged
16498 modCombatRating(CR_HASTE_SPELL, val); // spell
16499 }
16500 break;
16502 {
16503 modAttackPowerMods(val);
16505 }
16506 break;
16508 {
16510 }
16511 break;
16513 {
16514 modAttackPowerMods(val);
16515 }
16516 break;
16517#if VERSION_STRING > Classic
16519 {
16520 for (uint8_t school = 1; school < TOTAL_SPELL_SCHOOLS; ++school)
16521 {
16522 m_healDoneMod[school] += val;
16523 }
16524 modModHealingDone(val);
16525 }
16526 break;
16527#endif
16529 {
16530 for (uint8_t school = 1; school < TOTAL_SPELL_SCHOOLS; ++school)
16531 {
16532 modModDamageDonePositive(school, val);
16533 }
16534 }
16535 break;
16537 {
16538 m_manaFromItems += val;
16539 }
16540 break;
16541#if VERSION_STRING >= WotLK
16543 {
16545 }
16546 break;
16547#endif
16549 {
16550 for (uint8_t school = 1; school < 7; ++school)
16551 {
16552 modModDamageDonePositive(school, val);
16553 m_healDoneMod[school] += val;
16554 }
16555#if VERSION_STRING > Classic
16556 modModHealingDone(val);
16557#endif
16558 }
16559 break;
16560 }
16561}
@ ITEM_MOD_HIT_AVOIDANCE_RATING
@ ITEM_MOD_MELEE_CRITICAL_AVOIDANCE_RATING
@ ITEM_MOD_SPELL_CRITICAL_AVOIDANCE_RATING
@ ITEM_MOD_MELEE_HASTE_RATING
@ ITEM_MOD_SPELL_HIT_AVOIDANCE_RATING
@ ITEM_MOD_RANGED_HASTE_RATING
@ ITEM_MOD_CRITICAL_AVOIDANCE_RATING
@ ITEM_MOD_RANGED_HIT_AVOIDANCE_RATING
@ ITEM_MOD_MELEE_HIT_AVOIDANCE_RATING
@ ITEM_MOD_SPELL_HEALING_DONE
@ ITEM_MOD_WEAPON_SKILL_RATING
@ ITEM_MOD_RANGED_CRITICAL_AVOIDANCE_RATING
@ ITEM_MOD_SPELL_DAMAGE_DONE
@ CR_HIT_TAKEN_MELEE
@ CR_HASTE_RANGED
@ CR_HIT_MELEE
@ CR_RESILIENCE_PLAYER_DAMAGE_TAKEN
@ CR_CRIT_TAKEN_SPELL
@ CR_CRIT_MELEE
@ CR_CRIT_RANGED
@ CR_HIT_TAKEN_SPELL
@ CR_HASTE_MELEE
@ CR_HASTE_SPELL
@ CR_RESILIENCE_CRIT_TAKEN
@ CR_HIT_SPELL
@ CR_HIT_TAKEN_RANGED
@ CR_CRIT_SPELL
@ CR_HIT_RANGED
uint32_t m_healthFromItems
Definition Player.hpp:2219
void modModDamageDonePositive(uint16_t school, int32_t value)
Definition Player.cpp:1203
void modModHealingDone(int32_t value)
Definition Player.cpp:1215
uint32_t m_manaFromItems
Definition Player.hpp:2220
void modCombatRating(uint8_t combatRating, int32_t value)
Definition Player.cpp:1278
int32_t m_healDoneMod[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1445
void modRangedAttackPowerMods(int32_t modifier)
Definition Unit.cpp:1682
void modMaxPower(PowerType type, int32_t value)
Definition Unit.cpp:739
void modMaxHealth(int32_t maxHealth)
Definition Unit.cpp:643
void modAttackPowerMods(int32_t modifier)
Definition Unit.cpp:1643
void convert(char *val)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modifySkillBonus()

void Player::modifySkillBonus ( uint16_t  skillLine,
int16_t  amount,
bool  permanentBonus 
)

Definition at line 5004 of file Player.cpp.

5005{
5006 if (skillLine == 0)
5007 return;
5008
5009 auto itr = m_skills.find(skillLine);
5010 if (itr == m_skills.end() || itr->second.CurrentValue == 0)
5011 return;
5012
5013 if (permanentBonus)
5014 itr->second.PermanentBonusValue += amount;
5015 else
5016 itr->second.TemporaryBonusValue += amount;
5017
5018 // Bonuses can be negative but client still wants them in unsigned
5019 _updateSkillBonusFields(itr->second.FieldPosition, static_cast<uint16_t>(itr->second.TemporaryBonusValue), static_cast<uint16_t>(itr->second.PermanentBonusValue));
5020}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modifySkillMaximum()

void Player::modifySkillMaximum ( uint16_t  skillLine,
uint16_t  maxValue 
)

Definition at line 5022 of file Player.cpp.

5023{
5024 if (skillLine == 0)
5025 return;
5026
5027 auto itr = m_skills.find(skillLine);
5028 if (itr == m_skills.end())
5029 return;
5030
5031 const auto oldCurValue = itr->second.CurrentValue;
5032 const auto oldMaxValue = itr->second.MaximumValue;
5033 itr->second.MaximumValue = maxValue;
5034
5035 auto valuesChanged = false;
5036 uint16_t skillStep = 0;
5037
5038 _verifySkillValues(itr->second.Skill, &itr->second.CurrentValue, &itr->second.MaximumValue, &skillStep, &valuesChanged);
5039
5040 if (oldMaxValue != itr->second.MaximumValue || valuesChanged)
5041 {
5042 // Update skill fields
5043#if VERSION_STRING >= Cata
5044 if (itr->second.Skill->type != SKILL_TYPE_WEAPON)
5045#endif
5046 {
5047 _updateSkillFieldOnValueChange(itr->second.FieldPosition, skillStep, itr->second.CurrentValue, itr->second.MaximumValue);
5048 }
5049
5050#ifdef FT_ACHIEVEMENTS
5051 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, skillLine, skillStep, 0);
5052#endif
5053
5054 // Current skill value did not change
5055 if (oldCurValue == itr->second.CurrentValue)
5056 return;
5057
5058 sHookInterface.OnAdvanceSkillLine(this, skillLine, itr->second.CurrentValue);
5059
5060#ifdef FT_ACHIEVEMENTS
5061 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, skillLine, itr->second.CurrentValue, 0);
5062#endif
5063
5064 learnSkillSpells(skillLine, itr->second.CurrentValue);
5065 }
5066}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modModDamageDoneNegative()

void Player::modModDamageDoneNegative ( uint16_t  school,
int32_t  value 
)

Definition at line 1207 of file Player.cpp.

void setModDamageDoneNegative(uint16_t school, uint32_t value)
Definition Player.cpp:1206
Here is the call graph for this function:

◆ modModDamageDonePositive()

void Player::modModDamageDonePositive ( uint16_t  school,
int32_t  value 
)

Definition at line 1203 of file Player.cpp.

void setModDamageDonePositive(uint16_t school, uint32_t value)
Definition Player.cpp:1202
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modModHealingDone()

void Player::modModHealingDone ( int32_t  value)

Definition at line 1215 of file Player.cpp.

void setModHealingDone(uint32_t value)
Definition Player.cpp:1214
uint32_t getModHealingDone() const
Definition Player.cpp:1213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modModTargetPhysicalResistance()

void Player::modModTargetPhysicalResistance ( int32_t  value)

Definition at line 1223 of file Player.cpp.

uint32_t getModTargetPhysicalResistance() const
Definition Player.cpp:1221
void setModTargetPhysicalResistance(uint32_t value)
Definition Player.cpp:1222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modModTargetResistance()

void Player::modModTargetResistance ( int32_t  value)

Definition at line 1219 of file Player.cpp.

uint32_t getModTargetResistance() const
Definition Player.cpp:1217
void setModTargetResistance(uint32_t value)
Definition Player.cpp:1218
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modOffHandExpertise()

void Player::modOffHandExpertise ( int32_t  value)

Definition at line 1097 of file Player.cpp.

uint32_t getOffHandExpertise() const
Definition Player.cpp:1095
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onKillUnitReputation()

void Player::onKillUnitReputation ( Unit unit,
bool  innerLoop 
)

Definition at line 11633 of file Player.cpp.

11634{
11635 if (!unit)
11636 return;
11637
11638 if (!unit->isCreature() || unit->isPet() || unit->isCritter())
11639 return;
11640
11641 if (auto m_Group = getGroup())
11642 {
11643 if (!innerLoop)
11644 {
11645 m_Group->getLock().lock();
11646
11647 for (uint32_t i = 0; i < m_Group->GetSubGroupCount(); ++i)
11648 for (auto groupMember : m_Group->GetSubGroup(i)->getGroupMembers())
11649 if (auto player = sObjectMgr.getPlayer(groupMember->guid))
11650 if (player->isInRange(this, 100.0f))
11651 player->onKillUnitReputation(unit, true);
11652
11653 m_Group->getLock().unlock();
11654
11655 return;
11656 }
11657 }
11658
11659 const uint32_t team = getTeam();
11660 auto modifier = sObjectMgr.getReputationModifier(unit->getEntry(), unit->m_factionEntry->ID);
11661 if (modifier != nullptr)
11662 {
11663 for (auto& mod : modifier->mods)
11664 {
11665 if (!mod->faction[team])
11666 continue;
11667
11669 if (mod->replimit)
11670 if (getFactionStanding(mod->faction[team]) >= static_cast<int32_t>(mod->replimit))
11671 continue;
11672
11673 modFactionStanding(mod->faction[team], Util::float2int32(mod->value * worldConfig.getFloatRate(RATE_KILLREPUTATION)));
11674 }
11675 }
11676 else
11677 {
11678 if (IS_INSTANCE(GetMapId()) && sObjectMgr.handleInstanceReputationModifiers(this, unit))
11679 return;
11680
11681 if (unit->m_factionEntry->RepListId < 0)
11682 return;
11683
11684 const int32_t change = static_cast<int32_t>(-5.0f * worldConfig.getFloatRate(RATE_KILLREPUTATION));
11685 modFactionStanding(unit->m_factionEntry->ID, change);
11686 }
11687}
@ RATE_KILLREPUTATION
Definition WorldConfig.h:36
WDB::Structures::FactionEntry const * m_factionEntry
Definition Object.hpp:647
virtual bool isPet() const
Definition Object.hpp:203
bool isInRange(LocationVector location, float square_r) const
Definition Object.cpp:578
void onKillUnitReputation(Unit *unit, bool innerLoop)
Definition Player.cpp:11633
void modFactionStanding(uint32_t faction, int32_t value)
Definition Player.cpp:11448
virtual bool isCritter()
Definition Unit.hpp:1075
auto mod(T x, int y) -> T
Definition chrono.h:1652
Here is the call graph for this function:

◆ onModStanding()

void Player::onModStanding ( WDB::Structures::FactionEntry const factionEntry,
FactionReputation reputation 
)

Definition at line 11733 of file Player.cpp.

11734{
11735 if (!factionEntry || !reputation)
11736 return;
11737
11738 if (SetFlagVisible(reputation->flag, true) && IsInWorld())
11739 sendPacket(SmsgSetFactionVisible(factionEntry->RepListId).serialise().get());
11740
11742
11743 if (Visible(reputation->flag) && IsInWorld())
11744 sendPacket(SmsgSetFactionStanding(factionEntry->RepListId, reputation->CalcStanding()).serialise().get());
11745}
bool Visible(uint8_t flag)
Definition Player.cpp:11317
bool SetFlagAtWar(uint8_t &flag, bool set)
Definition Player.cpp:11321
bool SetFlagVisible(uint8_t &flag, bool set)
Definition Player.cpp:11333
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPrePushToWorld()

void Player::OnPrePushToWorld ( )
overridevirtual

Reimplemented from Object.

Definition at line 538 of file Player.cpp.

539{
541#if VERSION_STRING > TBC
542 m_achievementMgr->sendAllAchievementData(this);
543#endif
544
545 // Send initial power regen modifiers before push
550#if VERSION_STRING >= WotLK
552#endif
553}
void sendInitialLogonPackets()
Definition Player.cpp:3032
void updateRageRegeneration(bool initialUpdate=false)
void updateManaRegeneration(bool initialUpdate=false)
void updateRunicPowerRegeneration(bool initialUpdate=false)
void updateFocusRegeneration(bool initialUpdate=false)
Definition UnitStats.cpp:45
void updateEnergyRegeneration(bool initialUpdate=false)
Definition UnitStats.cpp:20
Here is the call graph for this function:

◆ OnPushToWorld()

void Player::OnPushToWorld ( )
overridevirtual

Reimplemented from Unit.

Definition at line 555 of file Player.cpp.

556{
557 uint8_t class_ = getClass();
558 uint8_t startlevel = 1;
559
560 // Process create packet
562
563 if (m_teleportState == 2) // Worldport Ack
565
567 m_beingPushed = false;
569
570 // set fly if cheat is active
572
574
575 // Update PVP Situation
577
578 if (m_playerInfo->lastOnline + 900 < UNIXTIME) // did we logged out for more than 15 minutes?
580
582
583 sHookInterface.OnEnterWorld(this);
584
586 {
589 }
590
591 if (m_teleportState == 1 || m_enteringWorld) // First world enter
593
594 m_enteringWorld = false;
595 m_teleportState = 0;
596
597 // can only fly in outlands or northrend (northrend requires cold weather flying)
598 if (m_flyingAura && ((m_mapId != 530) && (m_mapId != 571 || !hasSpell(54197) && getDeathState() == ALIVE)))
599 {
601 m_flyingAura = 0;
602 }
603
604 // send weather
605 sWeatherMgr.sendWeather(this);
606
610
611 if (m_firstLogin)
612 {
613 if (class_ == DEATHKNIGHT)
614 startlevel = static_cast<uint8_t>(std::max(55, worldConfig.player.playerStartingLevel));
615 else
616 startlevel = static_cast<uint8_t>(worldConfig.player.playerStartingLevel);
617
618 applyLevelInfo(startlevel);
619
620 setHealthPct(100);
621
622 // Sometimes power types aren't initialized - so initialize it again
623 switch (getClass())
624 {
625 case WARRIOR:
628 break;
629 case ROGUE:
632 break;
633#if VERSION_STRING >= WotLK
634 case DEATHKNIGHT:
638 break;
639#endif
640#if VERSION_STRING >= Cata
641 case HUNTER:
644#endif
645 default:
647 break;
648 }
649 m_firstLogin = false;
650
651 for (uint32_t spellId : m_playerCreateInfo->spell_cast_list)
652 castSpell(this, spellId, true);
653 }
654
655 if (!getSession()->HasGMPermissions())
657
659 {
660 if (m_WorldMap && reinterpret_cast<BattlegroundMap*>(m_WorldMap)->getBattleground() != nullptr && m_bg != reinterpret_cast<BattlegroundMap*>(m_WorldMap)->getBattleground())
661 reinterpret_cast<BattlegroundMap*>(m_WorldMap)->getBattleground()->portPlayer(this, true);
662 }
663
664 if (m_bg != nullptr)
665 {
666 m_bg->OnAddPlayer(this); // add buffs and so, must be after zone update and related aura removal
667 m_bg->onPlayerPushed(this);
668 }
669
670 m_changingMaps = false;
672
674 // Send enchant durations for unequipped items
676
678
679 if (m_resetTalents)
680 {
681 resetTalents();
682 m_resetTalents = false;
683 }
684
686
687#if VERSION_STRING == Mop
689
691 data.writeBits(0, 20);
692 data.flushBits();
693 sendPacket(&data);
694
695 data.Initialize(SMSG_BATTLE_PET_JOURNAL);
696 data.writeBits(0, 19);
697 data.writeBit(1);
698 data.writeBits(0, 25);
699 data.flushBits();
700 data << uint16_t(0);
701 sendPacket(&data);
702
704 sendPacket(&data);
705
706#endif
707
710}
@ SMSG_BATTLE_PET_JOURNAL_LOCK_ACQUIRED
Definition Opcodes.hpp:1772
@ SMSG_BATTLE_PET_JOURNAL
Definition Opcodes.hpp:1771
@ SMSG_LOAD_CUF_PROFILES
Definition Opcodes.hpp:1679
#define sWeatherMgr
bool isBattlegroundOrArena() const
Definition BaseMap.cpp:103
virtual void OnAddPlayer(Player *plr)=0
void portPlayer(Player *plr, bool skip_teleport=false)
void onPlayerPushed(Player *plr)
virtual void OnZoneChange(Player *, uint32_t, uint32_t)
virtual void OnPlayerEnter(Player *)
void HandleItemDurations()
Look for items with limited duration and send the remaining time to the client.
void sendEnchantDurations(Item const *forItem=nullptr)
void addItemsToWorld()
Definition Player.cpp:16083
uint32_t m_flyingAura
Definition Player.hpp:2177
void sendTaxiNodeStatusMultiple()
Definition Player.cpp:10748
void continueTaxiFlight() const
Definition Player.cpp:10700
void resetTalents()
Definition Player.cpp:5966
void onWorldPortAck()
Definition Player.cpp:1989
void processPendingUpdates()
Definition Player.cpp:13578
void summonTemporarilyUnsummonedPet()
Definition Player.cpp:12556
bool m_changingMaps
Definition Player.hpp:2179
void completeLoading()
Definition Player.cpp:16200
bool m_enteringWorld
Definition Player.hpp:785
void setupPvPOnLogin()
Definition Player.cpp:8218
void setHealthPct(uint32_t val)
Definition Unit.cpp:514
virtual void OnPushToWorld()
Definition Unit.cpp:353
void sendFullAuraUpdate()
Definition Unit.cpp:5655
void setMaxPower(PowerType type, uint32_t value)
Definition Unit.cpp:685
void updateVisibility()
Definition Unit.cpp:6244
MovementManager * getMovementManager()
Definition Unit.hpp:655
void setMoveCanFly(bool set_fly)
Definition Unit.cpp:2175
BaseMap * getBaseMap() const
Definition WorldMap.hpp:320

◆ onRemoveInRangeObject()

void Player::onRemoveInRangeObject ( Object object)
overridevirtual

Reimplemented from Unit.

Definition at line 15780 of file Player.cpp.

15781{
15782 if (object == nullptr)
15783 return;
15784
15785 if (isVisibleObject(object->getGuid()))
15786 {
15788 }
15789
15790 m_visibleObjects.erase(object->getGuid());
15792
15793 if (object->getGuid() == getCharmGuid())
15794 {
15795 Unit* unit = getWorldMap()->getUnit(getCharmGuid());
15796 if (!unit)
15797 return;
15798
15799 unPossess();
15800
15801 if (isCastingSpell())
15803
15804 setCharmGuid(0);
15805 }
15806}
bool isVisibleObject(uint64_t guid)
Definition Player.cpp:3599
UpdateManager & getUpdateMgr()
Definition Player.cpp:3554
virtual void onRemoveInRangeObject(Object *pObj)
Definition Unit.cpp:7573
void unPossess()
Definition Unit.cpp:9007
void pushOutOfRangeGuid(const WoWGuid &guid)
Here is the call graph for this function:

◆ onTalkReputation()

void Player::onTalkReputation ( WDB::Structures::FactionEntry const factionEntry)

Definition at line 11689 of file Player.cpp.

11690{
11691 if (!factionEntry || factionEntry->RepListId < 0)
11692 return;
11693
11694 FactionReputation* factionReputation = m_reputationByListId[factionEntry->RepListId];
11695 if (factionReputation == nullptr)
11696 return;
11697
11698 if (SetFlagVisible(factionReputation->flag, true) && IsInWorld())
11699 sendPacket(SmsgSetFactionVisible(factionEntry->RepListId).serialise().get());
11700}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onWorldPortAck()

void Player::onWorldPortAck ( )

Definition at line 1989 of file Player.cpp.

1990{
1991 WDB::Structures::MapEntry const* mEntry = sMapStore.lookupEntry(GetMapId());
1992 //only resurrect if player is porting to a instance portal
1993 if (mEntry->isInstanceMap() && isDead())
1994 resurrect();
1995
1996 if (mEntry->isInstanceMap())
1997 {
1998 // check if this instance has a reset time and send it to player if so
2000 if (WDB::Structures::MapDifficulty const* mapDiff = getMapDifficultyData(mEntry->id, diff))
2001 {
2002 if (mapDiff->resetTime)
2003 {
2004 if (time_t timeReset = sInstanceMgr.getResetTimeFor(static_cast<uint16_t>(mEntry->id), diff))
2005 {
2006 const auto now = Util::getTimeNow();
2007
2008 uint32_t timeleft = static_cast<uint32_t>(timeReset - now);
2009 sendInstanceResetWarning(mEntry->id, diff, timeleft, true);
2010 }
2011 }
2012 }
2013 }
2014
2016}
void sendInstanceResetWarning(uint32_t mapid, InstanceDifficulty::Difficulties difficulty, uint32_t time, bool welcome)
Definition Player.cpp:13016
time_t getTimeNow()
Definition Util.cpp:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ outPacket()

void Player::outPacket ( uint16_t  opcode,
uint16_t  length,
const void *  data 
)
overridevirtual

Reimplemented from Object.

Definition at line 3155 of file Player.cpp.

3156{
3157 if (m_session)
3158 m_session->OutPacket(opcode, length, data);
3159}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ outPacketToSet()

void Player::outPacketToSet ( uint16_t  opcode,
uint16_t  length,
const void *  data,
bool  sendToSelf 
)
overridevirtual

Reimplemented from Object.

Definition at line 3167 of file Player.cpp.

3168{
3169 if (!IsInWorld())
3170 return;
3171
3172 if (sendToSelf)
3173 outPacket(opcode, length, data);
3174
3175 for (const auto& objectPlayer : getInRangePlayersSet())
3176 {
3177 if (Player* player = static_cast<Player*>(objectPlayer))
3178 {
3179 if (m_isGmInvisible)
3180 {
3181 if (player->getSession()->hasPermissions())
3182 player->outPacket(opcode, length, data);
3183 }
3184 else
3185 {
3186 player->outPacket(opcode, length, data);
3187 }
3188 }
3189 }
3190}
void outPacket(uint16_t opcode, uint16_t length, const void *data) override
Definition Player.cpp:3155
bool m_isGmInvisible
Definition Player.hpp:1096
Here is the call graph for this function:

◆ playerData()

const WoWPlayer * Player::playerData ( ) const
inlineprivate

Definition at line 126 of file Player.hpp.

126{ return reinterpret_cast<WoWPlayer*>(wow_data); }
WoWObject * wow_data
Definition Object.hpp:119

◆ processPendingUpdates()

void Player::processPendingUpdates ( )

Definition at line 13578 of file Player.cpp.

13579{
13581}
void processPendingUpdates()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ regenerateHealth()

void Player::regenerateHealth ( bool  inCombat)

Definition at line 15932 of file Player.cpp.

15933{
15934 const auto currentHealth = getHealth();
15935 if (currentHealth == 0)
15936 return;
15937
15938 const auto maxHealth = getMaxHealth();
15939 if (currentHealth >= maxHealth)
15940 return;
15941
15942 float_t amt = 0.0f;
15943
15944 // While polymorphed health is regenerated rapidly
15945 // Exact value is yet unknown but it's roughly 10% of health per sec
15947 amt = getMaxHealth() * 0.10f;
15948 else
15949 amt = calculateHealthRegenerationValue(inCombat);
15950
15951 modHealth(static_cast<int32_t>(std::ceil(amt)));
15952}
@ UNIT_STATE_POLYMORPHED
float_t calculateHealthRegenerationValue(bool inCombat) const
void modHealth(int32_t health)
Definition Unit.cpp:502
Here is the call graph for this function:

◆ regeneratePlayerPowers()

void Player::regeneratePlayerPowers ( uint16_t  diff)

Definition at line 3781 of file Player.cpp.

3782{
3783#if VERSION_STRING < WotLK
3784 // Rage
3785 m_rageRegenerateTimer += diff;
3786 if (m_rageRegenerateTimer >= REGENERATION_INTERVAL_RAGE)
3787 {
3788 regeneratePower(POWER_TYPE_RAGE, m_rageRegenerateTimer);
3789 m_rageRegenerateTimer = 0;
3790 }
3791#endif
3792
3793#if VERSION_STRING >= Cata
3794 // Holy Power
3795 if (isClassPaladin())
3796 {
3799 {
3802 }
3803 }
3804#endif
3805
3806 // Food/Drink visual effect
3807 // Confirmed from sniffs that the timer keeps going on even when there is no food/drink aura
3808 if (diff >= m_foodDrinkSpellVisualTimer)
3809 {
3810 // Find food/drink aura
3811 const auto findFoodOrDrinkAura = [this](AuraEffect auraEffect) -> bool
3812 {
3813 for (const auto& aurEff : getAuraEffectList(auraEffect))
3814 {
3815 if (aurEff->getAura()->IsPassive() || aurEff->getAura()->isNegative())
3816 continue;
3817 if (aurEff->getAura()->getSpellInfo()->getAuraInterruptFlags() & AURA_INTERRUPT_ON_STAND_UP)
3818 return true;
3819 }
3820 return false;
3821 };
3822
3823 // Food takes priority over drink
3824 if (findFoodOrDrinkAura(SPELL_AURA_MOD_HEALTH_REGEN) || findFoodOrDrinkAura(SPELL_AURA_PERIODIC_HEAL_PCT))
3826 else if (findFoodOrDrinkAura(SPELL_AURA_MOD_POWER_REGEN) || findFoodOrDrinkAura(SPELL_AURA_PERIODIC_POWER_PCT))
3828
3830 }
3831 else
3832 {
3834 }
3835}
@ SPELL_AURA_PERIODIC_POWER_PCT
@ SPELL_AURA_MOD_POWER_REGEN
@ AURA_INTERRUPT_ON_STAND_UP
@ POWER_TYPE_HOLY_POWER
Definition PowerType.hpp:29
@ SPELL_VISUAL_DRINK
@ SPELL_VISUAL_FOOD
@ REGENERATION_INTERVAL_HOLY_POWER
uint16_t m_foodDrinkSpellVisualTimer
Definition Player.hpp:833
virtual bool isClassPaladin() const
Definition Player.cpp:2770
uint16_t m_holyPowerRegenerateTimer
Definition Player.hpp:829
void playSpellVisual(uint32_t visual_id, uint32_t type)
Definition Unit.cpp:3442
void regeneratePower(PowerType type, uint16_t timePassed)
Definition Unit.cpp:6447
Here is the call graph for this function:

◆ removeAllChannels()

void Player::removeAllChannels ( )

Definition at line 8043 of file Player.cpp.

8044{
8045 std::set<Channel*> removeList;
8046 m_mutexChannel.lock();
8047
8048 for (const auto& channel : m_channels)
8049 removeList.insert(channel);
8050
8051 m_mutexChannel.unlock();
8052
8053 auto itr = removeList.begin();
8054 while (itr != removeList.end())
8055 {
8056 (*itr)->leaveChannel(this);
8057 itr = removeList.erase(itr);
8058 }
8059}
Here is the caller graph for this function:

◆ removeAllSkills()

void Player::removeAllSkills ( )

Definition at line 5156 of file Player.cpp.

5157{
5158 for (auto itr = m_skills.cbegin(); itr != m_skills.cend();)
5159 {
5160 const auto itr2 = itr;
5161 ++itr;
5162
5163 // Skill is not necessarily erased from skill map
5164 removeSkillLine(itr2->first);
5165 }
5166}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeArenaPoints()

void Player::removeArenaPoints ( uint32_t  arenaPoints,
bool  sendUpdate 
)

Definition at line 8104 of file Player.cpp.

8105{
8106 int32_t newPoints = this->m_arenaPoints;
8107 newPoints -= arenaPoints;
8108 if (newPoints < 0)
8109 newPoints = 0;
8110
8111 this->m_arenaPoints = newPoints;
8112
8113 if (sendUpdate)
8114 this->updateArenaPoints();
8115}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeArmorProficiency()

void Player::removeArmorProficiency ( uint32_t  proficiency)

Definition at line 5233 of file Player.cpp.

5234{
5235 armorProficiency &= ~proficiency;
5236}
Here is the caller graph for this function:

◆ removeAuraVision()

void Player::removeAuraVision ( uint8_t  auraVision)
Here is the caller graph for this function:

◆ removeDeletedSpell()

bool Player::removeDeletedSpell ( uint32_t  spellId)

Definition at line 3950 of file Player.cpp.

3951{
3952 const auto itr = std::as_const(m_deletedSpellSet).find(spellId);
3953 if (itr == m_deletedSpellSet.cend())
3954 return false;
3955
3956 m_deletedSpellSet.erase(itr);
3957 return true;
3958}
Here is the caller graph for this function:

◆ removeFfaPvpFlag()

void Player::removeFfaPvpFlag ( )
overridevirtual

Reimplemented from Unit.

Definition at line 9840 of file Player.cpp.

9841{
9842 stopPvPTimer();
9843#if VERSION_STRING > TBC
9844 removePvpFlags(PVP_STATE_FLAG_FFA_PVP);
9845#else
9846 removePlayerFlags(PLAYER_FLAG_FREE_FOR_ALL_PVP);
9847#endif
9848
9850}
void stopPvPTimer()
Definition Player.cpp:8216
void setFFAPvPFlags(bool set)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeFromBgQueue()

void Player::removeFromBgQueue ( )

Definition at line 8562 of file Player.cpp.

8563{
8565 return;
8566
8569}
@ SS_BG_REMOVE_QUEUE_INF
void removePendingPlayer(Player *plr)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeFromFriendList()

void Player::removeFromFriendList ( uint32_t  guid)

Definition at line 9177 of file Player.cpp.

9178{
9179 if (isFriended(guid))
9180 {
9181 m_session->SendPacket(SmsgFriendStatus(FRIEND_REMOVED, guid).serialise().get());
9182
9183 CharacterDatabase.Execute("DELETE FROM social_friends WHERE character_guid = %u AND friend_guid = %u", getGuidLow(), guid);
9184
9185 std::lock_guard<std::mutex> guard(m_mutexFriendList);
9186 m_socialIFriends.erase(std::remove_if(m_socialIFriends.begin(), m_socialIFriends.end(), [&](SocialFriends const& friends) {
9187 return friends.friendGuid == guid;
9188 }),
9189 m_socialIFriends.end());
9190 }
9191 else
9192 {
9194 }
9195}
@ FRIEND_REMOVED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeFromGMTargetList()

void Player::removeFromGMTargetList ( uint32_t  guid)

Definition at line 2405 of file Player.cpp.

2406{
2407 std::lock_guard<std::mutex> guard(m_lockGMTargetList);
2408 m_gmPlayerTargetList.erase(std::remove(m_gmPlayerTargetList.begin(), m_gmPlayerTargetList.end(), guid), m_gmPlayerTargetList.end());
2409}
Here is the caller graph for this function:

◆ removeFromIgnoreList()

void Player::removeFromIgnoreList ( uint32_t  guid)

Definition at line 9341 of file Player.cpp.

9342{
9343 if (isIgnored(guid))
9344 {
9345 CharacterDatabase.Execute("DELETE FROM social_ignores WHERE character_guid = %u AND ignore_guid = %u", getGuidLow(), guid);
9346
9347 std::lock_guard<std::mutex> guard(m_mutexIgnoreList);
9348 m_socialIgnoring.erase(std::remove(m_socialIgnoring.begin(), m_socialIgnoring.end(), guid), m_socialIgnoring.end());
9349
9351 }
9352 else
9353 {
9355 }
9356}
@ FRIEND_IGNORE_REMOVED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeFromWorld()

void Player::removeFromWorld ( )

Definition at line 712 of file Player.cpp.

713{
716
719
720 if (m_bg)
721 m_bg->removePlayer(this, true);
722
723 // Cancel trade if it's active.
724 if (m_TradeData != nullptr)
725 cancelTrade(false);
726
727 //stop dueling
728 if (m_duelPlayer != nullptr)
730
731 //clear buyback
733
734 // Keep current pet active, Unit::RemoveFromWorld removes other summons
736
738 {
740 {
742 }
743 else
744 {
747
748 delete m_summonedObject;
749 }
750 m_summonedObject = nullptr;
751 }
752
753 if (IsInWorld())
754 {
757 }
758
759 m_changingMaps = true;
760 m_playerInfo->lastOnline = UNIXTIME; // don't destroy conjured items yet
761}
@ EVENT_PLAYER_EJECT_FROM_INSTANCE
Definition EventMgr.h:76
@ DUEL_WINNER_RETREAT
void removePlayer(Player *plr, bool logout)
void despawn(uint32_t delay, uint32_t forceRespawntime)
GameObject * ToGameObject()
Definition Object.hpp:399
virtual void RemoveFromWorld(bool free_guid)
Remove object from world.
Definition Object.cpp:3524
void unSummonPetTemporarily()
Definition Player.cpp:12585
void removeItemsFromWorld()
Definition Player.cpp:16112
void endDuel(uint8_t condition)
Definition Player.cpp:11955
uint32_t getPower(PowerType type) const
Definition Unit.cpp:516
virtual void RemoveFromWorld(bool free_guid)
Remove object from world.
Definition Unit.cpp:288
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeGarbageItems()

void Player::removeGarbageItems ( )
private

Definition at line 6970 of file Player.cpp.

6970{ m_GarbageItems.clear(); }
Here is the caller graph for this function:

◆ removeHonor()

void Player::removeHonor ( uint32_t  honorPoints,
bool  sendUpdate 
)

Definition at line 8149 of file Player.cpp.

8150{
8151 int32_t newPoints = this->m_honorPoints;
8152 newPoints -= honorPoints;
8153 if (newPoints < 0)
8154 newPoints = 0;
8155
8156 this->m_honorPoints = newPoints;
8157
8158 if (sendUpdate)
8159 this->updateHonor();
8160}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeIfVisiblePushOutOfRange()

void Player::removeIfVisiblePushOutOfRange ( uint64_t  guid)

Definition at line 3601 of file Player.cpp.

3602{
3603 if (m_visibleObjects.contains(guid))
3604 {
3605 m_visibleObjects.erase(guid);
3606#if VERSION_STRING <= TBC
3607 if (WoWGuid(guid).isGameObject() && !WoWGuid(guid).isTransport() && !WoWGuid(guid).isTransporter())
3609#endif
3611 }
3612}
virtual bool isTransporter() const
Definition Object.hpp:207
bool isGameObject() const
Definition Object.cpp:572
void sendDestroyObjectPacket(uint64_t destroyedGuid)
Definition Player.cpp:9611
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeItemsFromWorld()

void Player::removeItemsFromWorld ( )

Definition at line 16112 of file Player.cpp.

16113{
16114 for (uint8_t slotIndex = 0; slotIndex < CURRENCYTOKEN_SLOT_END; ++slotIndex)
16115 {
16116 if (Item* inventoryItem = getItemInterface()->GetInventoryItem((int8_t)slotIndex))
16117 {
16118 if (inventoryItem->IsInWorld())
16119 {
16120 if (slotIndex < INVENTORY_SLOT_BAG_END)
16121 applyItemMods(inventoryItem, static_cast<int16_t>(slotIndex), false, false, true);
16122
16123 inventoryItem->removeFromWorld();
16124 }
16125
16126 if (inventoryItem->isContainer() && getItemInterface()->IsBagSlot(static_cast<int16_t>(slotIndex)))
16127 {
16128 for (uint32_t containerSlot = 0; containerSlot < inventoryItem->getItemProperties()->ContainerSlots; ++containerSlot)
16129 {
16130 Item* item = (static_cast<Container*>(inventoryItem))->getItem(static_cast<int16_t>(containerSlot));
16131 if (item && item->IsInWorld())
16132 item->removeFromWorld();
16133 }
16134 }
16135 }
16136 }
16137
16138 updateStats();
16139}
void removeFromWorld()
Definition Item.cpp:1514
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removePendingPlayer()

void Player::removePendingPlayer ( )

Definition at line 3134 of file Player.cpp.

3135{
3136 if (m_session)
3137 {
3139 sendPacket(SmsgCharacterLoginFailed(respons).serialise().get());
3140 m_session->m_loggingInPlayer = nullptr;
3141 }
3142
3143 m_isReadyToBeRemoved = true;
3144 delete this;
3145}
@ E_CHAR_LOGIN_NO_CHARACTER
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removePetCache()

void Player::removePetCache ( uint8_t  petId)

Definition at line 12310 of file Player.cpp.

12311{
12312 const auto itr = std::as_const(m_cachedPets).find(petId);
12313 if (itr != m_cachedPets.cend())
12314 {
12315 std::erase_if(m_cachedPetSlots, [petId](const auto& slotItr) { return slotItr.second == petId; });
12316 m_cachedPets.erase(itr);
12317 }
12318
12319 // Pet will be deleted from playerpets table when player is saved
12320 CharacterDatabase.Execute("DELETE FROM playerpetspells WHERE ownerguid=%u AND petnumber=%u", getGuidLow(), petId);
12321}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removePlayerFieldBytesMiscFlag()

void Player::removePlayerFieldBytesMiscFlag ( uint8_t  miscFlag)

Definition at line 1232 of file Player.cpp.

Here is the call graph for this function:

◆ removePlayerFlags()

void Player::removePlayerFlags ( uint32_t  flags)

Definition at line 785 of file Player.cpp.

785{ setPlayerFlags(getPlayerFlags() & ~flags); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removePvpFlag()

void Player::removePvpFlag ( )
overridevirtual

Reimplemented from Unit.

Definition at line 9806 of file Player.cpp.

9807{
9808 stopPvPTimer();
9809#if VERSION_STRING > TBC
9810 removePvpFlags(PVP_STATE_FLAG_PVP);
9811 removePlayerFlags(PLAYER_FLAG_PVP_TIMER);
9812#else
9814#endif
9815
9817}
void setPvPFlags(bool set)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeQuestMob()

void Player::removeQuestMob ( uint32_t  entry)

Definition at line 9009 of file Player.cpp.

9010{
9011 if (!quest_mobs.empty())
9012 quest_mobs.erase(entry);
9013}
Here is the caller graph for this function:

◆ removeQuestSpell()

void Player::removeQuestSpell ( uint32_t  spellId)

Definition at line 8991 of file Player.cpp.

8992{
8993 if (!quest_spells.empty())
8994 quest_spells.erase(spellId);
8995}
Here is the caller graph for this function:

◆ removeSanctuaryFlag()

void Player::removeSanctuaryFlag ( )
overridevirtual

Reimplemented from Unit.

Definition at line 9874 of file Player.cpp.

9875{
9876#if VERSION_STRING > TBC
9877 removePvpFlags(PVP_STATE_FLAG_SANCTUARY);
9878#elif VERSION_STRING == TBC
9879 removePlayerFlags(PLAYER_FLAG_SANCTUARY);
9880#endif
9881
9883}
void setSanctuaryFlags(bool set)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeShapeShiftSpell()

void Player::removeShapeShiftSpell ( uint32_t  spellId)

Definition at line 4074 of file Player.cpp.

4075{
4076 m_shapeshiftSpells.erase(spellId);
4077 removeAllAurasById(spellId);
4078}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSkillLine()

void Player::removeSkillLine ( uint16_t  skillLine)

Definition at line 5068 of file Player.cpp.

5069{
5070 if (skillLine == 0)
5071 return;
5072
5073 auto itr = m_skills.find(skillLine);
5074 if (itr == m_skills.end())
5075 return;
5076
5077 const auto fieldPosition = itr->second.FieldPosition;
5078
5079 if (itr->second.Skill->type == SKILL_TYPE_PROFESSION)
5081
5082#if VERSION_STRING >= Cata
5083 // Clear profession skill line
5084 if (getProfessionSkillLine(0) == itr->second.Skill->id)
5086 else if (getProfessionSkillLine(1) == itr->second.Skill->id)
5088
5089 // Since cata, profession skills are never actually removed, they are only "deactivated"
5090 if (itr->second.Skill->type == SKILL_TYPE_PROFESSION || itr->second.Skill->type == SKILL_TYPE_SECONDARY)
5091 {
5092 itr->second.MaximumValue = 75;
5093 itr->second.CurrentValue = 0;
5094 itr->second.TemporaryBonusValue = 0;
5095 itr->second.PermanentBonusValue = 0;
5096 }
5097 else
5098#endif
5099 {
5100 m_skills.erase(itr);
5101 }
5102
5103 // Update skill fields
5104#if VERSION_STRING < Cata
5105 // field 0
5106 setSkillInfoId(fieldPosition.index, 0);
5107 setSkillInfoStep(fieldPosition.index, 0);
5108 // field 1
5109 setSkillInfoCurrentValue(fieldPosition.index, 0);
5110 setSkillInfoMaxValue(fieldPosition.index, 0);
5111#else
5112 // field 0
5113 setSkillInfoStep(fieldPosition.field, fieldPosition.offset, 0);
5114 // field 1
5115 setSkillInfoCurrentValue(fieldPosition.field, fieldPosition.offset, 0);
5116 setSkillInfoMaxValue(fieldPosition.field, fieldPosition.offset, 0);
5117#endif
5118 // field 2
5119 _updateSkillBonusFields(fieldPosition, 0, 0);
5120
5121 // Deactivate passive skill bonus auras
5122 for (const auto& aurEff : getAuraEffectList(SPELL_AURA_MOD_SKILL))
5123 {
5124 if (aurEff->getEffectMiscValue() == skillLine)
5125 {
5126 auto modifiableAurEff = aurEff->getAura()->getModifiableAuraEffect(aurEff->getEffectIndex());
5127 modifiableAurEff->setEffectActive(false);
5128 }
5129 }
5130
5131 // Deactivate passive skill bonus auras
5132 for (const auto& aurEff : getAuraEffectList(SPELL_AURA_MOD_SKILL_TALENT))
5133 {
5134 if (aurEff->getEffectMiscValue() == skillLine)
5135 {
5136 auto modifiableAurEff = aurEff->getAura()->getModifiableAuraEffect(aurEff->getEffectIndex());
5137 modifiableAurEff->setEffectActive(false);
5138 }
5139 }
5140
5141 // Remove skill spells
5142 removeSkillSpells(skillLine);
5143}
void removeSkillSpells(uint16_t skillLine)
Definition Player.cpp:5145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSkillSpells()

void Player::removeSkillSpells ( uint16_t  skillLine)

Definition at line 5145 of file Player.cpp.

5146{
5147 const auto skillRange = sSpellMgr.getSkillEntryRangeForSkill(skillLine);
5148 for (const auto& [_, skillEntry] : skillRange)
5149 {
5150 // Check also from deleted spells
5151 if (!removeSpell(skillEntry->spell, false))
5152 removeDeletedSpell(skillEntry->spell);
5153 }
5154}
bool removeSpell(uint32_t spellId, bool moveToDeleted)
Definition Player.cpp:3945
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSpell()

bool Player::removeSpell ( uint32_t  spellId,
bool  moveToDeleted 
)

Definition at line 3945 of file Player.cpp.

3946{
3947 return _removeSpell(spellId, moveToDeleted, false, false, false);
3948}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSummonSpell()

void Player::removeSummonSpell ( uint32_t  entry,
uint32_t  spellId 
)

Definition at line 13997 of file Player.cpp.

13998{
13999 std::map<uint32_t, std::set<uint32_t> >::iterator itr = m_summonSpells.find(entry);
14000 if (itr != m_summonSpells.end())
14001 {
14002 itr->second.erase(spellId);
14003 if (itr->second.size() == 0)
14004 m_summonSpells.erase(itr);
14005 }
14006}

◆ removeTempItemEnchantsOnArena()

void Player::removeTempItemEnchantsOnArena ( )

Definition at line 6939 of file Player.cpp.

6940{
6941 ItemInterface* itemInterface = getItemInterface();
6942
6944 if (Item* item = itemInterface->GetInventoryItem(static_cast<int16_t>(x)))
6945 item->removeAllEnchantments(true);
6946
6948 {
6949 if (Item* item = itemInterface->GetInventoryItem(static_cast<int16_t>(x)))
6950 {
6951 if (item->isContainer())
6952 {
6953 Container* bag = static_cast<Container*>(item);
6954 for (uint32_t ci = 0; ci < bag->getItemProperties()->ContainerSlots; ++ci)
6955 {
6956 if (auto* const bagItem = bag->getItem(static_cast<int16_t>(ci)))
6957 bagItem->removeAllEnchantments(true);
6958 }
6959 }
6960 }
6961 }
6962
6964 if (Item* item = itemInterface->GetInventoryItem(static_cast<int16_t>(x)))
6965 item->removeAllEnchantments(true);
6966}
@ INVENTORY_SLOT_ITEM_START
@ INVENTORY_SLOT_ITEM_END
@ INVENTORY_SLOT_BAG_START
Item * getItem(int16_t slot)
void removeAllEnchantments(bool onlyTemporary)
Definition Item.cpp:407
uint32_t ContainerSlots
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeVisibleObject()

void Player::removeVisibleObject ( uint64_t  guid)

Definition at line 3588 of file Player.cpp.

3589{
3590 if (isVisibleObject(guid))
3591 {
3592 m_visibleObjects.erase(guid);
3593#if VERSION_STRING <= TBC
3594 if (WoWGuid(guid).isGameObject() && !WoWGuid(guid).isTransport() && !WoWGuid(guid).isTransporter())
3596#endif
3597 }
3598}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeWeaponProficiency()

void Player::removeWeaponProficiency ( uint32_t  proficiency)

Definition at line 5248 of file Player.cpp.

5249{
5250 weaponProficiency &= ~proficiency;
5251}
Here is the caller graph for this function:

◆ repopAtGraveyard()

void Player::repopAtGraveyard ( float  ox,
float  oy,
float  oz,
uint32_t  mapId 
)

Definition at line 7622 of file Player.cpp.

7623{
7624#if VERSION_STRING >= WotLK
7626 return;
7627#endif
7628
7629 bool first = true;
7630
7631 LocationVector currentLocation(ox, oy, oz);
7632 LocationVector finalDestination;
7633 LocationVector temp;
7634
7635 if (!m_bg || !m_bg->HookHandleRepop(this))
7636 {
7637 float closestDistance = 999999.0f;
7638
7639 MySQLStructure::Graveyards const* graveyard = nullptr;
7640 for (const auto& graveyardStore : *sMySQLStore.getGraveyardsStore())
7641 {
7642 graveyard = sMySQLStore.getGraveyard(graveyardStore.second.id);
7643 if (graveyard->mapId == mapId && (graveyard->factionId == getTeam() || graveyard->factionId == 3))
7644 {
7645 temp.ChangeCoords({ graveyard->position_x, graveyard->position_y, graveyard->position_z });
7646 const float distance = currentLocation.distanceSquare(temp);
7647 if (first || distance < closestDistance)
7648 {
7649 first = false;
7650 closestDistance = distance;
7651 finalDestination = temp;
7652 }
7653 }
7654 }
7655
7656 if (first && graveyard)
7657 {
7658 finalDestination.ChangeCoords({ graveyard->position_x, graveyard->position_y, graveyard->position_z });
7659 first = false;
7660 }
7661 }
7662 else
7663 {
7664 return;
7665 }
7666
7667 if (sHookInterface.OnRepop(this) && !first)
7668 safeTeleport(mapId, 0, finalDestination);
7669}
@ SPELL_AURA_PREVENT_RESURRECTION
virtual bool HookHandleRepop(Player *plr)=0
bool hasAuraWithAuraEffect(AuraEffect type) const
Definition Unit.cpp:5060
double distance(double x, double y)
Definition g3dmath.h:731
Here is the call graph for this function:
Here is the caller graph for this function:

◆ repopRequest()

void Player::repopRequest ( )

Definition at line 7545 of file Player.cpp.

7546{
7547 sEventMgr.RemoveEvents(this, EVENT_PLAYER_CHECKFORCHEATS);
7548 sEventMgr.RemoveEvents(this, EVENT_PLAYER_FORCED_RESURRECT);
7549
7550 if (m_corpseData.instanceId != 0)
7551 {
7552 if (const auto corpse = sObjectMgr.getCorpseByOwner(getGuidLow()))
7553 corpse->resetDeathClock();
7554
7555 resurrect();
7557 return;
7558 }
7559
7560 if (auto transport = this->GetTransport())
7561 {
7562 transport->RemovePassenger(this);
7564
7566 return;
7567 }
7568
7570
7572
7574
7575 const bool hasCorpse = m_bg ? m_bg->CreateCorpse(this) : true;
7576 if (hasCorpse)
7577 createCorpse();
7578
7579 buildRepop();
7580
7581 if (!m_bg || m_bg && m_bg->hasStarted())
7582 {
7583 if (const auto mapInfo = sMySQLStore.getWorldMapInfo(GetMapId()))
7584 {
7585 if (mapInfo->isWorldMap() || mapInfo->isBattlegroundOrArena())
7587 else
7588 repopAtGraveyard(mapInfo->repopx, mapInfo->repopy, mapInfo->repopz, mapInfo->repopmapid);
7589
7590 switch (mapInfo->mapid)
7591 {
7592 case 533: // Naxx
7593 case 550: // The Eye
7594 case 552: // The Arcatraz
7595 case 553: // The Botanica
7596 case 554: // The Mechanar
7597 resurrect();
7598 return;
7599 default:
7600 break;
7601 }
7602 }
7603 else
7604 {
7606 }
7607 }
7608
7609 if (hasCorpse)
7610 {
7612
7613 if (m_corpseData.instanceId != 0)
7614 if (const auto corpse = sObjectMgr.getCorpseByOwner(getGuidLow()))
7615 corpse->resetDeathClock();
7616
7619 }
7620}
virtual bool CreateCorpse(Player *plr)
void createCorpse()
Definition Player.cpp:7445
void spawnCorpseBody()
Definition Player.cpp:7508
void buildRepop()
Definition Player.cpp:7711
Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestDuel()

void Player::requestDuel ( Player target)

Definition at line 11875 of file Player.cpp.

11876{
11877 if (m_duelPlayer != nullptr)
11878 return;
11879
11881 return;
11882
11884
11885 target->m_duelPlayer = this;
11886 m_duelPlayer = target;
11887
11888 // flag position
11889 const float distance = CalcDistance(target) * 0.5f;
11890 const float x = (GetPositionX() + target->GetPositionX() * distance) / (1 + distance) + cos(GetOrientation() + (M_PI_FLOAT / 2)) * 2;
11891 const float y = (GetPositionY() + target->GetPositionY() * distance) / (1 + distance) + sin(GetOrientation() + (M_PI_FLOAT / 2)) * 2;
11892 const float z = (GetPositionZ() + target->GetPositionZ() * distance) / (1 + distance);
11893
11894 // create flag
11895 if (GameObject* goFlag = getWorldMap()->createGameObject(21680))
11896 {
11897 goFlag->create(21680, m_WorldMap, GetPhase(), LocationVector(x, y, z, GetOrientation()), QuaternionData(), GO_STATE_CLOSED);
11898
11899 goFlag->setCreatedByGuid(getGuid());
11900 goFlag->SetFaction(getFactionTemplate());
11901 goFlag->setLevel(getLevel());
11902
11903 setDuelArbiter(goFlag->getGuid());
11904 target->setDuelArbiter(goFlag->getGuid());
11905
11906 goFlag->PushToWorld(m_WorldMap);
11907
11908 addGameObject(goFlag);
11909
11910 target->getSession()->SendPacket(SmsgDuelRequested(goFlag->getGuid(), getGuid()).serialise().get());
11911 }
11912}
#define M_PI_FLOAT
@ GO_STATE_CLOSED
@ DUEL_STATE_REQUESTED
float CalcDistance(Object *Ob)
Definition Object.cpp:3555
void addGameObject(GameObject *gameObj)
Definition Unit.cpp:8711
uint32_t getFactionTemplate() const
Definition Unit.cpp:957
GameObject * createGameObject(uint32_t entry)
G3D::int16 z
G3D::int16 y
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resendSpeed()

void Player::resendSpeed ( )

Definition at line 1501 of file Player.cpp.

1502{
1503 if (m_resendSpeed)
1504 {
1507 m_resendSpeed = false;
1508 }
1509}
@ TYPE_RUN
@ TYPE_FLY
bool m_resendSpeed
Definition Player.hpp:2180
float getSpeedRate(UnitSpeedType type, bool current) const
Definition Unit.cpp:2549
void setSpeedRate(UnitSpeedType mtype, float rate, bool current)
Definition Unit.cpp:2668
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetAllCooldowns()

void Player::resetAllCooldowns ( )

Definition at line 4454 of file Player.cpp.

4455{
4456 // Clear spell cooldowns
4457 for (const auto& spell : m_spellSet)
4458 clearCooldownForSpell(spell);
4459
4460 // Clear global cooldown
4462
4463 // Clear other cooldowns, like items
4464 for (uint8_t i = 0; i < NUM_COOLDOWN_TYPES; ++i)
4465 {
4466 for (auto itr = m_cooldownMap[i].begin(); itr != m_cooldownMap[i].end();)
4467 {
4468 auto spellId = (*itr).second.SpellId;
4469 getSession()->SendPacket(SmsgClearCooldown(spellId, getGuid()).serialise().get());
4470 itr = m_cooldownMap[i].erase(itr);
4471 }
4472 }
4473
4474 // Clear proc cooldowns
4476}
void clearGlobalCooldown()
Definition Player.cpp:4449
void clearProcCooldowns()
Definition Unit.cpp:3791
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetAllTalents()

void Player::resetAllTalents ( )

Definition at line 5996 of file Player.cpp.

5997{
5998 if (m_talentSpecsCount == 1)
5999 {
6000 resetTalents();
6001 return;
6002 }
6003
6004 const auto activeSpec = m_talentActiveSpec;
6005 resetTalents();
6006
6007 if (activeSpec == SPEC_PRIMARY)
6009 else
6011
6012 resetTalents();
6013 // Change back to the original spec
6014 activateTalentSpec(activeSpec);
6015}
void activateTalentSpec(uint8_t specId)
Definition Player.cpp:6237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetFinishedDailies()

void Player::resetFinishedDailies ( )

Definition at line 8892 of file Player.cpp.

8893{
8894 std::lock_guard<std::mutex> lock(m_mutextDailies);
8895 m_finishedDailies.clear();
8896}

◆ resetHolyPowerTimer()

void Player::resetHolyPowerTimer ( )

Definition at line 3838 of file Player.cpp.

3839{
3841}

◆ resetInstances()

void Player::resetInstances ( uint8_t  method,
bool  isRaid 
)

Definition at line 13046 of file Player.cpp.

13047{
13048 // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_JOIN
13049
13050 // we assume that when the difficulty changes, all instances that can be reset will be
13052
13053 for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();)
13054 {
13055 InstanceSaved* p = itr->second.save;
13056 WDB::Structures::MapEntry const* entry = sMapStore.lookupEntry(itr->first);
13057 if (!entry || entry->isRaid() != isRaid || !p->canReset())
13058 {
13059 ++itr;
13060 continue;
13061 }
13062
13063 if (method == INSTANCE_RESET_ALL)
13064 {
13065 // the "reset all instances" method can only reset normal maps
13067 {
13068 ++itr;
13069 continue;
13070 }
13071 }
13072
13073 // if the map is loaded, reset it
13074 WorldMap* map = sMapMgr.findWorldMap(p->getMapId(), p->getInstanceId());
13075 if (map && map->getBaseMap()->isInstanceMap())
13076 if (!reinterpret_cast<InstanceMap*>(map)->reset(method))
13077 {
13078 ++itr;
13079 continue;
13080 }
13081
13082 // since this is a solo instance there should not be any players inside
13083 if (method == INSTANCE_RESET_ALL || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
13085
13086 p->deleteFromDB();
13087 m_boundInstances[diff].erase(itr++);
13088
13089 // the following should remove the instance save from the manager and delete it as well
13090 p->removePlayer(this);
13091 }
13092}
@ INSTANCE_RESET_CHANGE_DIFFICULTY
@ INSTANCE_RESET_ALL
@ MAP_RAID
bool canReset() const
uint32_t getMapId() const
void deleteFromDB()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetPvPTimer()

void Player::resetPvPTimer ( )

Definition at line 8215 of file Player.cpp.

8215{ m_pvpTimer = worldConfig.getIntRate(INTRATE_PVPTIMER); }
@ INTRATE_PVPTIMER
Definition WorldConfig.h:50
uint32_t m_pvpTimer
Definition Player.hpp:1412
Here is the caller graph for this function:

◆ resetSpells()

void Player::resetSpells ( )

Definition at line 4039 of file Player.cpp.

4040{
4041 if (PlayerCreateInfo const* playerCreateInfo = sMySQLStore.getPlayerCreateInfo(getRace(), getClass()))
4042 {
4043 std::list<uint32_t> spelllist;
4044
4045 for (const auto& spellId : m_spellSet)
4046 spelllist.push_back(spellId);
4047
4048 for (std::list<uint32_t>::iterator itr = spelllist.begin(); itr != spelllist.end(); ++itr)
4049 removeSpell((*itr), false);
4050
4051 m_deletedSpellSet.clear();
4052
4053 for (std::set<uint32_t>::iterator sp = playerCreateInfo->spell_list.begin(); sp != playerCreateInfo->spell_list.end(); ++sp)
4054 {
4055 if (*sp)
4056 addSpell(*sp);
4057 }
4058 }
4059}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetTalents()

void Player::resetTalents ( )

Definition at line 5966 of file Player.cpp.

5967{
5968#if VERSION_STRING < Mop
5969 // Loop through player's talents
5970 for (const auto& [talentId, rank] : getActiveSpec().getTalents())
5971 {
5972 if (const auto* tmpTalent = sTalentStore.lookupEntry(talentId))
5973 _removeSpell(tmpTalent->RankID[rank], false, false, true, true);
5974 }
5975
5976 // Unsummon current pet or set temporarily unsummoned pet offline
5977 if (getPet() != nullptr)
5978 getPet()->unSummon();
5979 else
5981
5982 // Check offhand
5984
5985 // Clear talents
5987#if VERSION_STRING >= Cata
5989#endif
5990
5991 // Reset talent point amount
5993#endif
5994}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetTeam()

void Player::resetTeam ( )

Definition at line 2781 of file Player.cpp.

2782{
2784 m_bgTeam = m_team;
2785}
Here is the caller graph for this function:

◆ resetTimeSync()

void Player::resetTimeSync ( )

Definition at line 10314 of file Player.cpp.

10315{
10317 m_timeSyncTimer = 0;
10318 m_timeSyncClient = 0;
10320}
uint32_t m_timeSyncCounter
Definition Player.hpp:1922
uint32_t m_timeSyncServer
Definition Player.hpp:1925
uint32_t m_timeSyncTimer
Definition Player.hpp:1923
uint32_t m_timeSyncClient
Definition Player.hpp:1924
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resurrect()

void Player::resurrect ( )

Definition at line 7671 of file Player.cpp.

7672{
7673 if (!sHookInterface.OnResurrect(this))
7674 return;
7675
7676 sEventMgr.RemoveEvents(this, EVENT_PLAYER_FORCED_RESURRECT);
7677
7680
7681 if (m_resurrectMana)
7683
7685
7687
7689
7690 uint32_t AuraIds[] = { 20584, 9036, 8326, 55164, 0 };
7691 removeAllAurasById(AuraIds);
7692
7695
7697
7700
7701 m_resurrecter = 0;
7703
7704 for (uint8_t i = 0; i < 7; ++i)
7705 m_schoolImmunityList[i] = 0;
7706
7707 if (m_bg)
7709}
virtual void HookOnPlayerResurrect(Player *player)
uint64_t m_resurrecter
Definition Player.hpp:1216
uint32_t m_resurrectHealth
Definition Player.hpp:1217
uint32_t m_resurrectMapId
Definition Player.hpp:1220
LocationVector m_resurrectPosition
Definition Player.hpp:1221
uint32_t m_resurrectMana
Definition Player.hpp:1218
uint32_t m_resurrectInstanceID
Definition Player.hpp:1219
void spawnCorpseBones()
Definition Player.cpp:7531
void setMoveLandWalk()
Definition Unit.cpp:2020
uint32_t m_schoolImmunityList[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1451
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retRoles()

uint8_t Player::retRoles ( ) const

Definition at line 8581 of file Player.cpp.

8581{ return m_roles; }
uint8_t m_roles
Definition Player.hpp:1468
Here is the caller graph for this function:

◆ rolloverHonor()

void Player::rolloverHonor ( )

Definition at line 8178 of file Player.cpp.

8179{
8180 uint32_t current_val = (g_localTime.tm_year << 16) | g_localTime.tm_yday;
8181 if (current_val != m_honorRolloverTime)
8182 {
8183 m_honorRolloverTime = current_val;
8187 }
8188}
SERVER_DECL tm g_localTime
Definition Log.cpp:18
Here is the caller graph for this function:

◆ safeTeleport() [1/2]

bool Player::safeTeleport ( uint32_t  mapId,
uint32_t  instanceId,
const LocationVector vec 
)

Definition at line 1772 of file Player.cpp.

1773{
1774 // do not teleport to an unallowed mapId
1775 if (const auto mapInfo = sMySQLStore.getWorldMapInfo(mapId))
1776 {
1778 {
1780 return false;
1781 }
1782
1784 {
1786 return false;
1787 }
1788 }
1789
1790 // hide waypoints otherwise it will crash when trying to unload map
1791 if (m_aiInterfaceWaypoint != nullptr)
1793
1794 m_aiInterfaceWaypoint = nullptr;
1795
1796 speedCheatDelay(10000);
1797
1798 if (m_taxi->getCurrentTaxiPath())
1799 {
1800 sEventMgr.RemoveEvents(this, EVENT_PLAYER_TELEPORT);
1802
1805
1807 }
1808
1810 {
1811 if (const auto transporter = sTransportHandler.getTransporter(WoWGuid::getGuidLowPartFromUInt64(obj_movement_info.transport_guid)))
1812 {
1813 transporter->RemovePassenger(this);
1815 }
1816 }
1817
1818 bool instance = false;
1819 if (instanceId && static_cast<uint32_t>(m_instanceId) != instanceId)
1820 {
1821 instance = true;
1822 this->SetInstanceID(instanceId);
1823 }
1824 else if (m_mapId != mapId)
1825 {
1826 instance = true;
1827 }
1828
1829 // make sure player does not drown when teleporting from under water
1831 m_underwaterState &= ~UNDERWATERSTATE_UNDERWATER;
1832
1833 // can only fly in outlands or northrend (northrend requires cold weather flying)
1834 if (m_flyingAura && ((m_mapId != 530) && (m_mapId != 571 || !hasSpell(54197) && getDeathState() == ALIVE)))
1835 {
1837 m_flyingAura = 0;
1838 }
1839
1840#ifdef FT_VEHICLES
1841 callExitVehicle();
1842#endif
1843
1844 if (m_bg && m_bg->getWorldMap() && getWorldMap() && getWorldMap()->getBaseMap()->getMapInfo()->mapid != mapId)
1845 {
1846 m_bg->removePlayer(this, false);
1847 }
1848
1849 _Relocate(mapId, vec, true, instance, instanceId);
1850
1852
1854
1855 return true;
1856}
@ CHAT_MSG_SYSTEM
@ LANG_UNIVERSAL
@ EVENT_PLAYER_TELEPORT
Definition EventMgr.h:59
@ WMI_INSTANCE_XPACK_01
@ WMI_INSTANCE_XPACK_02
@ SS_MUST_HAVE_BC
@ SS_MUST_HAVE_WOTLK
bool hideWayPoints(Player *player)
WorldMap * getWorldMap()
void forceZoneUpdate()
Definition Player.cpp:2151
AIInterface * m_aiInterfaceWaypoint
Definition Player.hpp:1094
void _Relocate(uint32_t mapid, const LocationVector &v, bool sendpending, bool force_new_world, uint32_t instance_id)
Definition Player.cpp:15954
void sendChatMessage(uint8_t type, uint32_t language, std::string msg, Unit *receiver=nullptr, uint32_t sessionLanguage=0)
Definition Unit.cpp:6851
bool HasFlag(uint32_t flag)
Definition adtfile.h:41
Here is the call graph for this function:

◆ safeTeleport() [2/2]

void Player::safeTeleport ( WorldMap mgr,
const LocationVector vec 
)

Definition at line 1858 of file Player.cpp.

1859{
1860 if (mgr)
1861 {
1862 speedCheatDelay(10000);
1863
1864 // can only fly in outlands or northrend (northrend requires cold weather flying)
1865 if (m_flyingAura && ((m_mapId != 530) && (m_mapId != 571 || !hasSpell(54197) && getDeathState() == ALIVE)))
1866 {
1868 m_flyingAura = 0;
1869 }
1870
1871 if (IsInWorld())
1873
1874 m_mapId = mgr->getBaseMap()->getMapId();
1875 m_instanceId = mgr->getInstanceId();
1876
1879
1883
1886 }
1887}
uint32_t getMapId() const
Definition BaseMap.cpp:66
Here is the call graph for this function:

◆ saveAuras()

void Player::saveAuras ( std::stringstream &  ss)

Definition at line 16563 of file Player.cpp.

16564{
16565 ss << "'";
16566 uint32_t charges = 0;
16567 uint16_t prevX = 0;
16568
16569 // save all auras why only just positive?
16571 {
16572 auto* const aur = getAuraWithAuraSlot(x);
16573 if (aur != nullptr && aur->getTimeLeft() > 3000)
16574 {
16575 for (uint8_t i = 0; i < 3; ++i)
16576 if (aur->getSpellInfo()->getEffect(i) == SPELL_EFFECT_APPLY_GROUP_AREA_AURA || aur->getSpellInfo()->getEffect(i) == SPELL_EFFECT_APPLY_RAID_AREA_AURA || aur->getSpellInfo()->getEffect(i) == SPELL_EFFECT_ADD_FARSIGHT)
16577 continue;
16578
16579 if (aur->pSpellId)
16580 continue; // these auras were gained due to some proc. We do not save these either to avoid exploits of not removing them
16581
16582 if (aur->getSpellInfo()->custom_c_is_flags & SPELL_FLAG_IS_EXPIREING_WITH_PET)
16583 continue;
16584
16585 // we are going to cast passive spells anyway on login so no need to save auras for them
16586 if (aur->IsPassive() && !(aur->getSpellInfo()->getAttributesEx() & ATTRIBUTESEX_NO_INITIAL_AGGRO))
16587 continue;
16588
16589 auto* const prevAura = getAuraWithAuraSlot(prevX);
16590 if (charges > 0 && aur->getSpellId() != prevAura->getSpellId())
16591 {
16592 ss << prevAura->getSpellId() << "," << prevAura->getTimeLeft() << "," << !prevAura->isNegative() << "," << charges << ",";
16593 charges = 0;
16594 }
16595
16596 if (aur->getSpellInfo()->getProcCharges() == 0)
16597 ss << aur->getSpellId() << "," << aur->getTimeLeft() << "," << !aur->isNegative() << "," << uint32_t(0) << ",";
16598 else
16599 charges++;
16600
16601 prevX = x;
16602 }
16603 }
16604
16605 auto* const prevAura = getAuraWithAuraSlot(prevX);
16606 if (charges > 0 && prevAura)
16607 ss << prevAura->getSpellId() << "," << prevAura->getTimeLeft() << "," << !prevAura->isNegative() << "," << charges << ",";
16608
16609 ss << "'";
16610}
@ ATTRIBUTESEX_NO_INITIAL_AGGRO
@ SPELL_EFFECT_ADD_FARSIGHT
@ SPELL_EFFECT_APPLY_GROUP_AREA_AURA
@ SPELL_EFFECT_APPLY_RAID_AREA_AURA
@ REMOVABLE_SLOT_START
Definition AuraSlots.hpp:48
@ REMOVABLE_SLOT_END
Definition AuraSlots.hpp:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveDeletedSpells()

bool Player::saveDeletedSpells ( bool  newCharacter,
QueryBuffer buf 
)

Definition at line 13450 of file Player.cpp.

13451{
13452 if (!newCharacter && buf == nullptr)
13453 return false;
13454
13455 std::stringstream ds;
13456 uint32_t guid = getGuidLow();
13457
13458 ds << "DELETE FROM playerdeletedspells WHERE GUID = '";
13459 ds << guid;
13460 ds << "';";
13461
13462 if (!newCharacter)
13463 buf->AddQueryStr(ds.str());
13464 else
13465 CharacterDatabase.ExecuteNA(ds.str().c_str());
13466
13467 for (const auto& spellid : m_deletedSpellSet)
13468 {
13469 std::stringstream ss;
13470
13471 ss << "INSERT INTO playerdeletedspells VALUES('";
13472 ss << guid << "','";
13473 ss << spellid << "');";
13474
13475 if (!newCharacter)
13476 buf->AddQueryStr(ss.str());
13477 else
13478 CharacterDatabase.ExecuteNA(ss.str().c_str());
13479 }
13480
13481 return true;
13482}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveInstanceTimeRestrictions()

void Player::saveInstanceTimeRestrictions ( )

Definition at line 13134 of file Player.cpp.

13135{
13136 if (m_instanceResetTimes.empty())
13137 return;
13138
13139 CharacterDatabase.Execute("DELETE FROM account_instance_times WHERE accountId = %u", getSession()->GetAccountId());
13140
13141 for (InstanceTimeMap::const_iterator itr = m_instanceResetTimes.begin(); itr != m_instanceResetTimes.end(); ++itr)
13142 {
13143 CharacterDatabase.Execute("INSERT INTO account_instance_times (accountId, instanceId, releaseTime) VALUES (%u, %u, %u)", getSession()->GetAccountId(), itr->first, itr->second);
13144 }
13145}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveReputations()

bool Player::saveReputations ( bool  newCharacter,
QueryBuffer buf 
)

Definition at line 13356 of file Player.cpp.

13357{
13358 if (!newCharacter && (buf == nullptr))
13359 return false;
13360
13361 std::stringstream ds;
13362 uint32_t guid = getGuidLow();
13363
13364 ds << "DELETE FROM playerreputations WHERE guid = '";
13365 ds << guid;
13366 ds << "';";
13367
13368 if (!newCharacter)
13369 buf->AddQueryStr(ds.str());
13370 else
13371 CharacterDatabase.ExecuteNA(ds.str().c_str());
13372
13373 for (ReputationMap::iterator itr = m_reputation.begin(); itr != m_reputation.end(); ++itr)
13374 {
13375 std::stringstream ss;
13376
13377 ss << "INSERT INTO playerreputations VALUES('";
13378 ss << getGuidLow() << "','";
13379 ss << itr->first << "','";
13380 ss << uint32_t(itr->second->flag) << "','";
13381 ss << itr->second->baseStanding << "','";
13382 ss << itr->second->standing << "');";
13383
13384 if (!newCharacter)
13385 buf->AddQueryStr(ss.str());
13386 else
13387 CharacterDatabase.ExecuteNA(ss.str().c_str());
13388 }
13389
13390 return true;
13391}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveSkills()

bool Player::saveSkills ( bool  newCharacter,
QueryBuffer buf 
)

Definition at line 13484 of file Player.cpp.

13485{
13486 if (!newCharacter && buf == nullptr)
13487 return false;
13488
13489 std::stringstream ds;
13490 uint32_t guid = getGuidLow();
13491
13492 ds << "DELETE FROM playerskills WHERE GUID = '";
13493 ds << guid;
13494 ds << "';";
13495
13496 if (!newCharacter)
13497 buf->AddQueryStr(ds.str());
13498 else
13499 CharacterDatabase.ExecuteNA(ds.str().c_str());
13500
13501 for (SkillMap::iterator itr = m_skills.begin(); itr != m_skills.end(); ++itr)
13502 {
13503 uint32_t skillid = itr->first;
13504 uint32_t currval = itr->second.CurrentValue;
13505 uint32_t maxval = itr->second.MaximumValue;
13506
13507 // Skip only initialized values
13508 if (currval == 0)
13509 continue;
13510
13511 std::stringstream ss;
13512
13513 ss << "INSERT INTO playerskills VALUES('";
13514 ss << guid << "','";
13515 ss << skillid << "','";
13516 ss << currval << "','";
13517 ss << maxval << "');";
13518
13519 if (!newCharacter)
13520 buf->AddQueryStr(ss.str());
13521 else
13522 CharacterDatabase.ExecuteNA(ss.str().c_str());
13523 }
13524
13525 return true;
13526}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveSpells()

bool Player::saveSpells ( bool  newCharacter,
QueryBuffer buf 
)

Definition at line 13393 of file Player.cpp.

13394{
13395 if (!newCharacter && buf == nullptr)
13396 return false;
13397
13398 std::stringstream ds;
13399 uint32_t guid = getGuidLow();
13400
13401 ds << "DELETE FROM playerspells WHERE GUID = '";
13402 ds << guid;
13403 ds << "';";
13404
13405 if (!newCharacter)
13406 buf->AddQueryStr(ds.str());
13407 else
13408 CharacterDatabase.ExecuteNA(ds.str().c_str());
13409
13410 for (const auto& spellid : m_spellSet)
13411 {
13412 std::stringstream ss;
13413
13414 ss << "INSERT INTO playerspells VALUES('";
13415 ss << guid << "','";
13416 ss << spellid << "');";
13417
13418 if (!newCharacter)
13419 buf->AddQueryStr(ss.str());
13420 else
13421 CharacterDatabase.ExecuteNA(ss.str().c_str());
13422 }
13423
13424 return true;
13425}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToDB()

void Player::saveToDB ( bool  newCharacter)

Definition at line 14132 of file Player.cpp.

14133{
14134 bool in_arena = false;
14135 std::unique_ptr<QueryBuffer> bufPtr = nullptr;
14136 QueryBuffer* buf = nullptr;
14137 if (!newCharacter)
14138 {
14139 bufPtr = std::make_unique<QueryBuffer>();
14140 buf = bufPtr.get();
14141 }
14142
14143 if (m_bg != nullptr && m_bg->isArena())
14144 in_arena = true;
14145
14146 //Calc played times
14147 uint32_t playedt = (uint32_t)UNIXTIME - m_playedTime[2];
14148 m_playedTime[0] += playedt;
14149 m_playedTime[1] += playedt;
14150 m_playedTime[2] += playedt;
14151
14152 // active cheats
14153 uint32_t active_cheats = PLAYER_CHEAT_NONE;
14155 active_cheats |= PLAYER_CHEAT_COOLDOWN;
14157 active_cheats |= PLAYER_CHEAT_CAST_TIME;
14159 active_cheats |= PLAYER_CHEAT_GOD_MODE;
14161 active_cheats |= PLAYER_CHEAT_POWER;
14163 active_cheats |= PLAYER_CHEAT_FLY;
14165 active_cheats |= PLAYER_CHEAT_AURA_STACK;
14167 active_cheats |= PLAYER_CHEAT_ITEM_STACK;
14169 active_cheats |= PLAYER_CHEAT_TRIGGERPASS;
14171 active_cheats |= PLAYER_CHEAT_TAXI;
14172
14173 std::stringstream ss;
14174
14175 ss << "REPLACE INTO characters VALUES (" << getGuidLow() << ", " << getSession()->GetAccountId() << ", " << "'" << m_name << "', "
14176 << uint32_t(getRace()) << ", " << uint32_t(getClass()) << ", " << uint32_t(getGender()) << ", " << getFactionTemplate() << ", ";
14177
14178 ss << uint32_t(getLevel()) << ", " << getXp() << ", " << active_cheats << ", ";
14179
14180 // exploration data
14181 ss << "'";
14182 for (uint8_t i = 0; i < WOWPLAYER_EXPLORED_ZONES_COUNT; ++i)
14183 ss << getExploredZone(i) << ",";
14184 ss << "', ";
14185
14186 saveSkills(newCharacter, buf);
14187
14188 ss << getWatchedFaction() << ", "
14189#if VERSION_STRING > Classic
14190 << getChosenTitle() << ", "
14191#else
14192 << uint32_t(0) << ", "
14193#endif
14194
14195#if VERSION_STRING > Classic
14196 << getKnownTitles(0) << ", "
14197#else
14198 << uint32_t(0) << ", "
14199#endif
14200
14201#if VERSION_STRING < WotLK
14202 << uint32_t(0) << ", " << uint32_t(0) << ", "
14203#else
14204 << getKnownTitles(1) << ", " << getKnownTitles(2) << ", "
14205#endif
14206 << getCoinage() << ", ";
14207
14208 if (getClass() == MAGE || getClass() == PRIEST || (getClass() == WARLOCK))
14209 ss << uint32_t(0) << ", "; // make sure ammo slot is 0 for these classes, otherwise it can mess up wand shoot
14210 else
14211#if VERSION_STRING < Cata
14212 ss << getAmmoId() << ", ";
14213#else
14214 ss << uint32_t(0) << ", ";
14215#endif
14216
14217 ss << getFreePrimaryProfessionPoints() << ", ";
14218
14219 ss << m_loadHealth << ", " << m_loadMana << ", " << uint32_t(getPvpRank()) << ", " << getPlayerBytes() << ", " << getPlayerBytes2() << ", ";
14220
14221 // Remove un-needed and problematic player flags from being saved :p
14224
14227
14230
14233
14236
14237#if VERSION_STRING < WotLK
14238 if (hasPlayerFlags(PLAYER_FLAG_FREE_FOR_ALL_PVP))
14239 removePlayerFlags(PLAYER_FLAG_FREE_FOR_ALL_PVP);
14240#endif
14241
14242#if VERSION_STRING >= WotLK
14243 if (hasPlayerFlags(PLAYER_FLAG_DEVELOPER))
14244 removePlayerFlags(PLAYER_FLAG_DEVELOPER);
14245#endif
14246
14247#if VERSION_STRING == TBC
14248 if (hasPlayerFlags(PLAYER_FLAG_SANCTUARY))
14249 removePlayerFlags(PLAYER_FLAG_SANCTUARY);
14250#endif
14251
14252 ss << getPlayerFlags() << ", " << std::to_string(getEnabledActionBars()) << ", ";
14253
14254 // if its an arena, save the entry coords instead of the normal position
14255 if (in_arena)
14256 ss << getBGEntryPosition().x << ", " << getBGEntryPosition().y << ", " << getBGEntryPosition().z << ", " << getBGEntryPosition().o << ", " << getBGEntryMapId() << ", ";
14257 else
14258 ss << m_position.x << ", " << m_position.y << ", " << m_position.z << ", " << m_position.o << ", " << m_mapId << ", ";
14259
14260 ss << m_zoneId << ", ";
14261
14262 // taxi mask
14263 ss << "'";
14264
14265 ss << m_taxi->saveTaximaskNodeToString();
14266
14267 ss << "', ";
14268
14269 ss << m_banned << ", '" << CharacterDatabase.EscapeString(m_banreason) << "', " << uint32_t(UNIXTIME) << ", ";
14270
14271 //online state
14272 if (getSession()->_loggingOut || newCharacter)
14273 ss << "0, ";
14274 else
14275 ss << "1, ";
14276
14277 ss << getBindPosition().x << ", " << getBindPosition().y << ", " << getBindPosition().z << ", " << getBindPosition().o << ", " << getBindMapId() << ", " << getBindZoneId() << ", ";
14278
14279 ss << uint32_t(m_isResting) << ", " << uint32_t(m_restState) << ", " << uint32_t(m_restAmount) << ", ";
14280
14281 ss << "'" << uint32_t(m_playedTime[0]) << " " << uint32_t(m_playedTime[1]) << " " << uint32_t(playedt) << "', ";
14282
14283 ss << uint32_t(m_deathState) << ", " << m_talentResetsCount << ", " << m_firstLogin << ", " << m_loginFlag << ", " << m_arenaPoints << ", " << (uint32_t)m_stableSlotCount << ", ";
14284
14285 // instances
14286 if (in_arena)
14287 ss << getBGEntryInstanceId() << ", ";
14288 else
14289 ss << m_instanceId << ", ";
14290
14291 ss << getBGEntryMapId() << ", " << getBGEntryPosition().x << ", " << getBGEntryPosition().y << ", " << getBGEntryPosition().z << ", " << getBGEntryPosition().o << ", " << getBGEntryInstanceId() << ", ";
14292
14293 // taxi destination
14294 ss << "'";
14295 ss << m_taxi->saveTaxiDestinationsToString();
14296 ss << "', ";
14297
14298 // last node
14299 if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(getMovementManager()->getCurrentMovementGenerator()))
14300 ss << flight->getCurrentNode() << ", ";
14301 else
14302 ss << uint32_t(0) << ", ";
14303
14304 const auto transport = this->GetTransport();
14305 if (!transport)
14306 ss << uint32_t(0) << ",'0','0','0','0'" << ", ";
14307 else
14308 ss << transport->getEntry() << ",'" << GetTransOffsetX() << "','" << GetTransOffsetY() << "','" << GetTransOffsetZ() << "','" << GetTransOffsetO() << "'" << ", ";
14309
14310 saveSpells(newCharacter, buf);
14311
14312 saveDeletedSpells(newCharacter, buf);
14313
14314 saveReputations(newCharacter, buf);
14315
14316 // Add player action bars
14317#ifdef FT_DUAL_SPEC
14318 for (uint8_t s = 0; s < MAX_SPEC_COUNT; ++s)
14319 {
14320 ss << "'";
14321 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
14322 {
14323 ss << uint32_t(m_specs[s].getActionButton(i).Action) << ","
14324 << uint32_t(m_specs[s].getActionButton(i).Type) << ","
14325 << uint32_t(m_specs[s].getActionButton(i).Misc) << ",";
14326 }
14327 ss << "'" << ", ";
14328 }
14329#else
14330 ss << "'";
14331 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
14332 {
14333 ss << uint32_t(m_spec.getActionButton(i).Action) << ","
14334 << uint32_t(m_spec.getActionButton(i).Type) << ","
14335 << uint32_t(m_spec.getActionButton(i).Misc) << ",";
14336 }
14337 ss << "'" << ", " << "''" << ", ";
14338#endif
14339
14340 if (!newCharacter)
14341 {
14342 saveAuras(ss);
14343 ss << ", ";
14344 }
14345 else
14346 {
14347 ss << "''" << ", ";
14348 }
14349
14350 // Add player finished quests
14351 ss << "'";
14352 for (auto finishedQuests = m_finishedQuests.begin(); finishedQuests != m_finishedQuests.end(); ++finishedQuests)
14353 ss << (*finishedQuests) << ",";
14354 ss << "'" << ", ";
14355
14356 // add finished dailies
14357 ss << "'";
14358 for (auto finishedDailies : getFinishedDailies())
14359 ss << finishedDailies << ",";
14360 ss << "'" << ", ";
14361
14362 ss << m_honorRolloverTime << ", " << m_killsToday << ", " << m_killsYesterday << ", " << m_killsLifetime << ", " << m_honorToday << ", " << m_honorYesterday << ", " << m_honorPoints << ", ";
14363
14364 ss << uint32_t(getDrunkValue()) << ", ";
14365
14366 // TODO Remove
14367#ifdef FT_DUAL_SPEC
14368 for (uint8_t s = 0; s < MAX_SPEC_COUNT; ++s)
14369 {
14370 ss << "'";
14371 for (uint8_t i = 0; i < GLYPHS_COUNT; ++i)
14372 ss << uint32_t(m_specs[s].getGlyph(i)) << ",";
14373
14374 ss << "', '";
14375 for (const auto& [talentId, rank] : m_specs[s].getTalents())
14376 ss << uint32_t(talentId) << "," << uint32_t(rank) << ",";
14377
14378 ss << "'" << ", ";
14379 }
14380#else
14381 ss << "'', '";
14382 for (const auto& [talentId, rank] : m_spec.getTalents())
14383 ss << talentId << "," << rank << ",";
14384
14385 ss << "', '', '', ";
14386#endif
14387
14388 ss << uint32_t(m_talentSpecsCount) << ", " << uint32_t(m_talentActiveSpec) << ", ";
14389
14390 ss << "'";
14391#ifdef FT_DUAL_SPEC
14392 ss << uint32_t(m_specs[SPEC_PRIMARY].getTalentPoints()) << " " << uint32_t(m_specs[SPEC_SECONDARY].getTalentPoints());
14393#else
14394 ss << uint32_t(m_spec.getTalentPoints()) << " 0";
14395#endif
14396 ss << "'" << ", ";
14397
14398#if VERSION_STRING < Cata
14399 ss << "'" << uint32_t(0) << "', ";
14400#else
14401 ss << "'" << uint32_t(m_FirstTalentTreeLock) << "', ";
14402#endif
14403
14404 ss << "'" << m_phase << "', ";
14405
14406 uint32_t xpfield = 0;
14407
14409 xpfield = 1;
14410
14411 ss << "'" << xpfield << "'" << ", ";
14412
14413 const bool saveData = worldConfig.server.saveExtendedCharData;
14414 if (saveData)
14415 {
14416 ss << "'";
14417 for (uint32_t offset = getSizeOfStructure(WoWObject); offset < getSizeOfStructure(WoWPlayer); offset++)
14418 ss << uint32_t(m_uint32Values[offset]) << ";";
14419 ss << "'" << ", ";
14420 }
14421 else
14422 {
14423 ss << "'', ";
14424 }
14425
14426 if (m_resetTalents)
14427 ss << uint32_t(1);
14428 else
14429 ss << uint32_t(0);
14430
14431 ss << ", ";
14432
14433 ss << uint32_t(this->hasWonRbgToday()) << ", " << uint32_t(m_dungeonDifficulty) << ", " << uint32_t(m_raidDifficulty);
14434 ss << ")";
14435
14436 if (newCharacter)
14437 CharacterDatabase.WaitExecuteNA(ss.str().c_str());
14438 else
14439 buf->AddQueryNA(ss.str().c_str());
14440
14441 // Save Other related player stuff
14442
14443 // Inventory
14444 getItemInterface()->mSaveItemsToDatabase(newCharacter, buf);
14445
14447
14448 // save quest progress
14450
14451 // Tutorials
14452 saveTutorials();
14453
14454 // GM Ticket
14455 //\todo Is this really necessary? Tickets will always be saved on creation, update and so on...
14456 GM_Ticket* ticket = sTicketMgr.getGMTicketByPlayer(getGuid());
14457 if (ticket != nullptr)
14458 sTicketMgr.saveGMTicket(ticket, buf);
14459
14460 // Cooldown Items
14462
14463 // Instance Timed Lockout
14465
14466 // Pets
14467 if (getClass() == HUNTER || getClass() == WARLOCK)
14468 {
14469 _savePet(buf, true);
14471 }
14473#if VERSION_STRING > TBC
14474 m_achievementMgr->saveToDb(buf);
14475#endif
14476
14477 if (buf)
14478 CharacterDatabase.AddQueryBuffer(std::move(bufPtr));
14479}
@ PLAYER_FLAG_PVP_TOGGLE
@ PLAYER_FLAG_PARTY_LEADER
@ PLAYER_CHEAT_NONE
#define sTicketMgr
Definition TicketMgr.hpp:97
bool SavetoDB(QueryBuffer *buf)
void mSaveItemsToDatabase(bool first, QueryBuffer *buf)
Item saving.
float GetTransOffsetO() const
Definition Object.hpp:384
ActionButton & getActionButton(uint8_t slot)
uint8_t getPvpRank() const
Definition Player.cpp:861
void saveAuras(std::stringstream &)
Definition Player.cpp:16563
bool saveReputations(bool newCharacter, QueryBuffer *buf)
Definition Player.cpp:13356
void _savePlayerCooldowns(QueryBuffer *buf)
Definition Player.cpp:4665
uint8_t getEnabledActionBars() const
Definition Player.cpp:1234
void saveInstanceTimeRestrictions()
Definition Player.cpp:13134
bool saveDeletedSpells(bool newCharacter, QueryBuffer *buf)
Definition Player.cpp:13450
uint32_t getWatchedFaction() const
Definition Player.cpp:1138
uint32_t getPlayerBytes2() const
Definition Player.cpp:838
std::set< uint32_t > getFinishedDailies() const
Definition Player.cpp:8882
bool hasWonRbgToday() const
Definition Player.cpp:8571
void _saveQuestLogEntry(QueryBuffer *buf)
Definition Player.cpp:14481
uint32_t getPlayerBytes() const
Definition Player.cpp:821
uint8_t getDrunkValue() const
Definition Player.cpp:858
void _savePet(QueryBuffer *buf, bool updateCurrentPetCache=false, Pet *currentPet=nullptr)
Definition Player.cpp:13794
bool saveSkills(bool newCharacter, QueryBuffer *buf)
Definition Player.cpp:13484
void saveTutorials()
Definition Player.cpp:6361
bool saveSpells(bool newCharacter, QueryBuffer *buf)
Definition Player.cpp:13393
void _savePetSpells(QueryBuffer *buf)
Definition Player.cpp:13948
uint32_t getBindZoneId() const
Definition Player.cpp:7818
Here is the caller graph for this function:

◆ saveTutorials()

void Player::saveTutorials ( )

Definition at line 6361 of file Player.cpp.

6362{
6363 if (m_tutorialsDirty)
6364 {
6365 CharacterDatabase.Execute("DELETE FROM tutorials WHERE playerid = %u;", getGuidLow());
6366 CharacterDatabase.Execute("INSERT INTO tutorials VALUES('%u','%u','%u','%u','%u','%u','%u','%u','%u');", getGuidLow(), m_tutorials[0], m_tutorials[1], m_tutorials[2], m_tutorials[3], m_tutorials[4], m_tutorials[5], m_tutorials[6], m_tutorials[7]);
6367
6368 m_tutorialsDirty = false;
6369 }
6370}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendActionBars()

void Player::sendActionBars ( uint8_t  action)

Definition at line 6384 of file Player.cpp.

6385{
6386#if VERSION_STRING < Mop
6388
6389#if VERSION_STRING == WotLK
6390 data << uint8_t(action);
6391#endif
6392
6393 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6394 {
6395 // TODO: this needs investigation
6396 // action, as in spell id, can be and will be over uint16_t max (65535) on wotlk and cata
6397 // but if I send action in uint32_t, client ignores the button completely and leaves an empty button slot, or corrupts other slots as well
6398 // however casting the action to uint16_t seems to somehow work. I tested it with a spell id over 65535.
6399 // but this is not a solution and can cause undefined behaviour... (previously ActionButton::Action was stored in uint16_t)
6400 // I believe client accepts at most 4 bytes per button -Appled
6401 data << uint16_t(getActiveSpec().getActionButton(i).Action);
6402#if VERSION_STRING < WotLK
6403 data << getActiveSpec().getActionButton(i).Type;
6404 data << getActiveSpec().getActionButton(i).Misc;
6405#else
6406 // Since Wotlk misc needs to be sent before type
6407 data << getActiveSpec().getActionButton(i).Misc;
6408 data << getActiveSpec().getActionButton(i).Type;
6409#endif
6410 }
6411#else
6413
6415
6416 // Bits
6417 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6418 data.writeBit(buttons[i][4]);
6419
6420 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6421 data.writeBit(buttons[i][5]);
6422
6423 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6424 data.writeBit(buttons[i][3]);
6425
6426 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6427 data.writeBit(buttons[i][1]);
6428
6429 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6430 data.writeBit(buttons[i][6]);
6431
6432 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6433 data.writeBit(buttons[i][7]);
6434
6435 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6436 data.writeBit(buttons[i][0]);
6437
6438 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6439 data.writeBit(buttons[i][2]);
6440
6441 // Data
6442 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6443 data.WriteByteSeq(buttons[i][0]);
6444
6445 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6446 data.WriteByteSeq(buttons[i][1]);
6447
6448 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6449 data.WriteByteSeq(buttons[i][4]);
6450
6451 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6452 data.WriteByteSeq(buttons[i][6]);
6453
6454 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6455 data.WriteByteSeq(buttons[i][7]);
6456
6457 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6458 data.WriteByteSeq(buttons[i][2]);
6459
6460 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6461 data.WriteByteSeq(buttons[i][5]);
6462
6463 for (uint8_t i = 0; i < PLAYER_ACTION_BUTTON_COUNT; ++i)
6464 data.WriteByteSeq(buttons[i][3]);
6465#endif
6466
6467#if VERSION_STRING >= Cata
6468 data << uint8_t(action);
6469#endif
6470
6471 getSession()->SendPacket(&data);
6472}
@ SMSG_UPDATE_ACTION_BUTTONS
Definition Opcodes.hpp:341
#define PLAYER_ACTION_BUTTON_SIZE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendAreaTriggerMessage()

void Player::sendAreaTriggerMessage ( const char *  message,
  ... 
)

Definition at line 6563 of file Player.cpp.

6564{
6565 va_list list;
6566 va_start(list, message);
6567 char msg[500];
6568 vsnprintf(msg, 500, message, list);
6569 va_end(list);
6570
6571 m_session->SendPacket(SmsgAreaTriggerMessage(0, msg, 0).serialise().get());
6572}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendAuctionCommandResult()

void Player::sendAuctionCommandResult ( Auction auction,
uint32_t  Action,
uint32_t  ErrorCode,
uint32_t  bidError = 0 
)

Definition at line 6476 of file Player.cpp.

6477{
6478 const auto auctionId = auction ? auction->Id : 0;
6479
6480#if VERSION_STRING >= Cata
6481 uint64_t outBid = 0;
6482 uint64_t highestBid = 0;
6483#else
6484 uint32_t outBid = 0;
6485 uint32_t highestBid = 0;
6486#endif
6487 uint64_t highestBidderGuid = 0;
6488
6489 if (auction)
6490 {
6491 outBid = auction->highestBid ? auction->getAuctionOutBid() : 0;
6492 highestBid = auction->highestBid;
6493 highestBidderGuid = auction->highestBidderGuid;
6494 }
6495
6496 sendPacket(SmsgAuctionCommandResult(auctionId, action, errorCode, outBid, highestBid, bidError, highestBidderGuid).serialise().get());
6497}
uint32_t Id
uint64_t highestBid
WoWGuid highestBidderGuid
uint64_t getAuctionOutBid() const
the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendAvailSpells()

void Player::sendAvailSpells ( WDB::Structures::SpellShapeshiftFormEntry const shapeshiftFormEntry,
bool  active 
)

Definition at line 4085 of file Player.cpp.

4086{
4087 if (active)
4088 {
4089 if (!shapeshiftFormEntry)
4090 return;
4091
4092 // Send the spells
4093 SmsgPetActionsArray actions{};
4094 for (uint8_t i = 0; i < 8; ++i)
4095 {
4096#if VERSION_STRING >= TBC
4097 actions[i] = packPetActionButtonData(shapeshiftFormEntry->spells[i], PET_SPELL_STATE_DEFAULT);
4098#else
4099 actions[i] = 0;
4100#endif
4101 }
4102 actions[8] = 0;
4103 actions[9] = 0;
4104
4105 getSession()->SendPacket(SmsgPetSpells(getGuid(), 0, 0, 0, 0, 0, std::move(actions), SmsgPetSpellsVector()).serialise().get());
4106 }
4107 else
4108 {
4110 }
4111}
@ PET_SPELL_STATE_DEFAULT
void sendEmptyPetSpellList()
Definition Player.cpp:9767
std::array< uint32_t, MAX_ACTION_SLOT > SmsgPetActionsArray
std::vector< uint32_t > SmsgPetSpellsVector
static constexpr uint32_t packPetActionButtonData(uint32_t spellId, uint8_t state)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCastFailedPacket()

void Player::sendCastFailedPacket ( uint32_t  spellId,
uint8_t  errorMessage,
uint8_t  multiCast,
uint32_t  extra1,
uint32_t  extra2 = 0 
)

Definition at line 9714 of file Player.cpp.

9715{
9716 m_session->SendPacket(SmsgCastFailed(multiCast, spellId, errorMessage, extra1, extra2).serialise().get());
9717}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCinematicCamera()

void Player::sendCinematicCamera ( uint32_t  id)

Definition at line 10276 of file Player.cpp.

10277{
10279 SetPosition(float(GetPositionX() + 0.01), float(GetPositionY() + 0.01), float(GetPositionZ() + 0.01), GetOrientation());
10280 m_session->SendPacket(SmsgTriggerCinematic(id).serialise().get());
10281}
void changeObjectLocation(Object *obj)
Here is the call graph for this function:

◆ sendCinematicOnFirstLogin()

void Player::sendCinematicOnFirstLogin ( )

Definition at line 9536 of file Player.cpp.

9537{
9538 if (m_firstLogin && !worldConfig.player.skipCinematics)
9539 {
9540#if VERSION_STRING > TBC
9541 if (const auto charEntry = sChrClassesStore.lookupEntry(getClass()))
9542 {
9543 if (charEntry->cinematic_id != 0)
9544 sendPacket(SmsgTriggerCinematic(charEntry->cinematic_id).serialise().get());
9545 else if (const auto raceEntry = sChrRacesStore.lookupEntry(getRace()))
9546 sendPacket(SmsgTriggerCinematic(raceEntry->cinematic_id).serialise().get());
9547 }
9548#else
9549 if (const auto raceEntry = sChrRacesStore.lookupEntry(getRace()))
9550 sendPacket(SmsgTriggerCinematic(raceEntry->cinematic_id).serialise().get());
9551#endif
9552 }
9553}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendClientControlPacket()

void Player::sendClientControlPacket ( Unit target,
uint8_t  allowMove 
)

Definition at line 9732 of file Player.cpp.

9733{
9734 sendPacket(SmsgClientControlUpdate(target->GetNewGUID(), allowMove).serialise().get());
9735
9736 if (target == this)
9737 setMover(this);
9738}
void setMover(Unit *target)
Definition Player.cpp:10283
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendDelayedPacket()

void Player::sendDelayedPacket ( WorldPacket data,
bool  deleteDataOnSend 
)

Definition at line 3230 of file Player.cpp.

3231{
3232 if (data == nullptr)
3233 return;
3234
3235 if (m_session)
3236 m_session->SendPacket(data);
3237
3238 if (deleteDataOnSend)
3239 delete data;
3240}
Here is the call graph for this function:

◆ sendDestroyObjectPacket()

void Player::sendDestroyObjectPacket ( uint64_t  destroyedGuid)

Definition at line 9611 of file Player.cpp.

9612{
9613 m_session->SendPacket(SmsgDestroyObject(destroyedGuid).serialise().get());
9614}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendDismountResultPacket()

void Player::sendDismountResultPacket ( uint32_t  result)

Definition at line 9709 of file Player.cpp.

Here is the call graph for this function:

◆ sendDungeonDifficultyPacket()

void Player::sendDungeonDifficultyPacket ( )

Definition at line 9572 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendEmptyPetSpellList()

void Player::sendEmptyPetSpellList ( )

Definition at line 9767 of file Player.cpp.

9768{
9769 m_session->SendPacket(SmsgPetSpells(0).serialise().get());
9770}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendEquipmentSetList()

void Player::sendEquipmentSetList ( )

Definition at line 9748 of file Player.cpp.

9749{
9750#if VERSION_STRING > TBC
9753 m_session->SendPacket(&data);
9754#endif
9755}
@ SMSG_EQUIPMENT_SET_LIST
Definition Opcodes.hpp:1344
void FillEquipmentSetListPacket(WorldPacket &data)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendEquipmentSetSaved()

void Player::sendEquipmentSetSaved ( uint32_t  setId,
uint32_t  setGuid 
)

Definition at line 9757 of file Player.cpp.

9758{
9759#if VERSION_STRING > TBC
9761 data << uint32_t(setId);
9762 data << WoWGuid(uint64_t(setGuid));
9763 m_session->SendPacket(&data);
9764#endif
9765}
@ SMSG_EQUIPMENT_SET_SAVED
Definition Opcodes.hpp:1152
void setGuid(uint64_t guid)
Definition Object.cpp:296
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendEquipmentSetUseResultPacket()

void Player::sendEquipmentSetUseResultPacket ( uint8_t  result)

Definition at line 9616 of file Player.cpp.

9617{
9618#if VERSION_STRING > TBC
9619 m_session->SendPacket(SmsgEquipmentSetUseResult(result).serialise().get());
9620#endif
9621}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendExploreExperiencePacket()

void Player::sendExploreExperiencePacket ( uint32_t  areaId,
uint32_t  experience 
)

Definition at line 9671 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendForceMovePacket()

void Player::sendForceMovePacket ( UnitSpeedType  speed_type,
float  speed 
)

Definition at line 1321 of file Player.cpp.

1322{
1323 WorldPacket data(60);
1324 switch (speed_type)
1325 {
1326 case TYPE_WALK:
1327 {
1328 data.Initialize(SMSG_FORCE_WALK_SPEED_CHANGE);
1330 break;
1331 }
1332 case TYPE_RUN:
1333 {
1334 data.Initialize(SMSG_FORCE_RUN_SPEED_CHANGE);
1336 break;
1337 }
1338 case TYPE_RUN_BACK:
1339 {
1340 data.Initialize(SMSG_FORCE_RUN_BACK_SPEED_CHANGE);
1342 break;
1343 }
1344 case TYPE_SWIM:
1345 {
1346 data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE);
1348 break;
1349 }
1350 case TYPE_SWIM_BACK:
1351 {
1352 data.Initialize(SMSG_FORCE_SWIM_BACK_SPEED_CHANGE);
1354 break;
1355 }
1356 case TYPE_TURN_RATE:
1357 {
1358 data.Initialize(SMSG_FORCE_TURN_RATE_CHANGE);
1359 //movement_info.Write(data, SMSG_FORCE_TURN_RATE_CHANGE, speed);
1360 break;
1361 }
1362 case TYPE_FLY:
1363 {
1364 data.Initialize(SMSG_FORCE_FLIGHT_SPEED_CHANGE);
1366 break;
1367 }
1368 case TYPE_FLY_BACK:
1369 {
1370 data.Initialize(SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE);
1371 //movement_info.Write(data, SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE, speed);
1372 break;
1373 }
1374 case TYPE_PITCH_RATE:
1375 {
1376 data.Initialize(SMSG_FORCE_PITCH_RATE_CHANGE);
1377 //movement_info.Write(data, SMSG_FORCE_PITCH_RATE_CHANGE, speed);
1378 break;
1379 }
1380 }
1381
1382 sendMessageToSet(&data, true);
1383}
@ SMSG_FORCE_TURN_RATE_CHANGE
Definition Opcodes.hpp:802
@ SMSG_FORCE_WALK_SPEED_CHANGE
Definition Opcodes.hpp:798
@ SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE
Definition Opcodes.hpp:981
@ SMSG_FORCE_RUN_SPEED_CHANGE
Definition Opcodes.hpp:269
@ SMSG_FORCE_SWIM_BACK_SPEED_CHANGE
Definition Opcodes.hpp:800
@ SMSG_FORCE_RUN_BACK_SPEED_CHANGE
Definition Opcodes.hpp:271
@ SMSG_FORCE_FLIGHT_SPEED_CHANGE
Definition Opcodes.hpp:979
@ SMSG_FORCE_SWIM_SPEED_CHANGE
Definition Opcodes.hpp:273
@ SMSG_FORCE_PITCH_RATE_CHANGE
Definition Opcodes.hpp:1248
@ TYPE_RUN_BACK
@ TYPE_SWIM_BACK
@ TYPE_SWIM
@ TYPE_WALK
@ TYPE_TURN_RATE
@ TYPE_FLY_BACK
@ TYPE_PITCH_RATE
void writeMovementInfo(ByteBuffer &data, uint16_t opcode, float custom_speed=0.f, ExtraMovementStatusElement *extras=nullptr) const
Definition Object.cpp:5465
Here is the call graph for this function:

◆ sendFriendLists()

void Player::sendFriendLists ( uint32_t  flags)

Definition at line 9243 of file Player.cpp.

9244{
9245 std::vector<SmsgContactListMember> contactMemberList;
9246
9247 if (flags & 0x01) // friend
9248 {
9249 uint32_t maxCount = 0;
9250
9251 std::lock_guard<std::mutex> guard(m_mutexFriendList);
9252 for (auto friends : m_socialIFriends)
9253 {
9254 SmsgContactListMember friendListMember;
9255 friendListMember.guid = friends.friendGuid;
9256 friendListMember.flag = 0x01;
9257 friendListMember.note = friends.note;
9258
9259 if (auto* plr = sObjectMgr.getPlayer(friends.friendGuid))
9260 {
9261 friendListMember.isOnline = 1;
9262 friendListMember.zoneId = plr->getZoneId();
9263 friendListMember.level = plr->getLevel();
9264 friendListMember.playerClass = plr->getClass();
9265 }
9266 else
9267 {
9268 friendListMember.isOnline = 0;
9269 }
9270
9271 contactMemberList.push_back(friendListMember);
9272 ++maxCount;
9273
9274 if (maxCount >= 50)
9275 break;
9276 }
9277
9278 }
9279
9280 if (flags & 0x02) // ignore
9281 {
9282 uint32_t maxCount = 0;
9283
9284 std::lock_guard<std::mutex> guard(m_mutexIgnoreList);
9285 for (auto ignoredGuid : m_socialIgnoring)
9286 {
9287 SmsgContactListMember ignoreListMember;
9288 ignoreListMember.guid = ignoredGuid;
9289 ignoreListMember.flag = 0x02;
9290 ignoreListMember.note = "";
9291
9292 contactMemberList.push_back(ignoreListMember);
9293 ++maxCount;
9294
9295 if (maxCount >= 50)
9296 break;
9297 }
9298 }
9299
9300 sendPacket(SmsgContactList(flags, contactMemberList).serialise().get());
9301}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendFriendStatus()

void Player::sendFriendStatus ( bool  comesOnline)

Definition at line 9222 of file Player.cpp.

9223{
9224 std::lock_guard<std::mutex> guard(m_mutexFriendedBy);
9225 if (!m_socialFriendedByGuids.empty())
9226 {
9227 for (auto friendedGuids : m_socialFriendedByGuids)
9228 {
9229 if (auto* targetPlayer = sObjectMgr.getPlayer(friendedGuids))
9230 {
9231 if (targetPlayer->getSession())
9232 {
9233 if (comesOnline)
9234 targetPlayer->sendPacket(SmsgFriendStatus(FRIEND_ONLINE, getGuid(), "", 1, getAreaId(), getLevel(), getClass()).serialise().get());
9235 else
9236 targetPlayer->sendPacket(SmsgFriendStatus(FRIEND_OFFLINE, getGuid()).serialise().get());
9237 }
9238 }
9239 }
9240 }
9241}
@ FRIEND_ONLINE
@ FRIEND_OFFLINE
std::mutex m_mutexFriendedBy
Definition Player.hpp:1563
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendGossipPoiPacket()

void Player::sendGossipPoiPacket ( float  posX,
float  posY,
uint32_t  icon,
uint32_t  flags,
uint32_t  data,
std::string  name 
)

Definition at line 9635 of file Player.cpp.

9636{
9637 m_session->SendPacket(SmsgGossipPoi(flags, posX, posY, icon, data, name).serialise().get());
9638}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendGuildMotd()

void Player::sendGuildMotd ( )

Definition at line 9740 of file Player.cpp.

9741{
9742 if (!getGuild())
9743 return;
9744
9745 sendPacket(SmsgGuildEvent(GE_MOTD, { getGuild()->getMOTD() }, 0).serialise().get());
9746}
std::string const & getMOTD() const
Definition Guild.hpp:50
Here is the call graph for this function:

◆ sendInitialLogonPackets()

void Player::sendInitialLogonPackets ( )

Definition at line 3032 of file Player.cpp.

3033{
3034 sLogger.debug("Player {} gets prepared for login.", getName());
3035
3036#if VERSION_STRING == Mop
3038
3039 smsg_TalentsInfo(false);
3040
3041 WorldPacket data(SMSG_WORLD_SERVER_INFO, 4 + 4 + 1 + 1);
3042 data.writeBit(0);
3043 data.writeBit(0);
3044 data.writeBit(0);
3045 data.writeBit(0);
3046 data.flushBits();
3047
3048 data << uint8_t(0);
3049 data << uint32_t(0); // reset weekly quest time
3050 data << uint32_t(0);
3051 getSession()->SendPacket(&data);
3052
3054
3055 m_session->SendPacket(SmsgSendUnlearnSpells().serialise().get());
3056
3057 sendActionBars(0);
3058
3060
3061 data.Initialize(SMSG_LOAD_EQUIPMENT_SET);
3062 data.writeBits(0, 19);
3063 getSession()->SendPacket(&data);
3064
3065 m_session->SendPacket(SmsgLoginSetTimeSpeed(Util::getGameTime(), 0.0166666669777748f).serialise().get());
3066
3067 data.Initialize(SMSG_SET_FORCED_REACTIONS, 1 + 4 + 4);
3068 data.writeBits(0, 6);
3069 data.flushBits();
3070 getSession()->SendPacket(&data);
3071
3072 data.Initialize(SMSG_SETUP_CURRENCY, 3 + 1 + 4 + 4 + 4 + 4);
3073 data.writeBits(0, 21);
3074 getSession()->SendPacket(&data);
3075
3076 ObjectGuid guid = getGuid();
3077 data.Initialize(SMSG_MOVE_SET_ACTIVE_MOVER);
3078 data.writeBit(guid[5]);
3079 data.writeBit(guid[1]);
3080 data.writeBit(guid[4]);
3081 data.writeBit(guid[2]);
3082 data.writeBit(guid[3]);
3083 data.writeBit(guid[7]);
3084 data.writeBit(guid[0]);
3085 data.writeBit(guid[6]);
3086
3087 data.WriteByteSeq(guid[4]);
3088 data.WriteByteSeq(guid[6]);
3089 data.WriteByteSeq(guid[2]);
3090 data.WriteByteSeq(guid[0]);
3091 data.WriteByteSeq(guid[3]);
3092 data.WriteByteSeq(guid[7]);
3093 data.WriteByteSeq(guid[5]);
3094 data.WriteByteSeq(guid[1]);
3095 getSession()->SendPacket(&data);
3096
3097#else
3099
3100 std::vector<uint32_t> tutorials;
3101 for (auto tutorial : m_tutorials)
3102 tutorials.push_back(tutorial);
3103
3104 m_session->SendPacket(SmsgTutorialFlags(tutorials).serialise().get());
3105
3106#if VERSION_STRING > TBC
3107 smsg_TalentsInfo(false);
3108#endif
3109
3111
3112 m_session->SendPacket(SmsgSendUnlearnSpells().serialise().get());
3113
3114 sendActionBars(0);
3116
3117 m_session->SendPacket(SmsgLoginSetTimeSpeed(Util::getGameTime(), 0.0166666669777748f).serialise().get());
3118
3119 updateSpeed();
3120
3121#if VERSION_STRING > TBC
3122 m_session->SendPacket(SmsgUpdateWorldState(0xC77, worldConfig.arena.arenaProgress, 0xF3D, worldConfig.arena.arenaSeason).serialise().get());
3123#endif
3124#endif
3125
3126 sLogger.info("WORLD: Sent initial logon packets for {}.", getName());
3127}
@ SMSG_LOAD_EQUIPMENT_SET
Definition Opcodes.hpp:1770
@ SMSG_SET_FORCED_REACTIONS
Definition Opcodes.hpp:740
@ SMSG_SETUP_CURRENCY
Definition Opcodes.hpp:1660
@ SMSG_WORLD_SERVER_INFO
Definition Opcodes.hpp:1767
@ SMSG_MOVE_SET_ACTIVE_MOVER
Definition Opcodes.hpp:1687
void sendSmsgInitialSpells()
Definition Player.cpp:3970
void sendSmsgInitialFactions()
Definition Player.cpp:11762
void updateSpeed()
Definition Unit.cpp:2954
uint32_t getGameTime()
Returns generated time value for client packets.
Definition Util.cpp:282
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendInitialWorldstates()

void Player::sendInitialWorldstates ( )

Definition at line 9772 of file Player.cpp.

9773{
9774#if VERSION_STRING < Cata
9777 m_session->SendPacket(&data);
9778#endif
9779}
@ SMSG_INIT_WORLD_STATES
Definition Opcodes.hpp:773
WorldStatesHandler & getWorldStatesHandler()
void BuildInitWorldStatesForZone(uint32_t _zone, uint32_t _area, WorldPacket &_data) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendInstanceDifficultyPacket()

void Player::sendInstanceDifficultyPacket ( uint8_t  difficulty)

Definition at line 9591 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendInstanceResetWarning()

void Player::sendInstanceResetWarning ( uint32_t  mapid,
InstanceDifficulty::Difficulties  difficulty,
uint32_t  time,
bool  welcome 
)

Definition at line 13016 of file Player.cpp.

13017{
13018 // type of warning, based on the time remaining until reset
13019 uint32_t type;
13020 if (welcome)
13022 else if (time > 21600)
13024 else if (time > 3600)
13026 else if (time > 300)
13028 else
13030
13031 WorldPacket data(SMSG_RAID_INSTANCE_MESSAGE, 4 + 4 + 4 + 4);
13032 data << uint32_t(type);
13033 data << uint32_t(mapid);
13034 data << uint32_t(difficulty); // difficulty
13035 data << uint32_t(time);
13036
13037 if (type == RAID_INSTANCE_WELCOME)
13038 {
13039 data << uint8_t(0); // is locked
13040 data << uint8_t(0); // is extended, ignored if prev field is 0
13041 }
13042
13043 sendPacket(&data);
13044}
@ RAID_INSTANCE_WARNING_MIN
@ RAID_INSTANCE_WARNING_MIN_SOON
@ RAID_INSTANCE_WARNING_HOURS
@ RAID_INSTANCE_WELCOME
@ SMSG_RAID_INSTANCE_MESSAGE
Definition Opcodes.hpp:832
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendItemPushResultPacket()

void Player::sendItemPushResultPacket ( bool  created,
bool  recieved,
bool  sendtoset,
uint8_t  destbagslot,
uint32_t  destslot,
uint32_t  count,
uint32_t  entry,
uint32_t  suffix,
uint32_t  randomprop,
uint32_t  stack 
)

Definition at line 9724 of file Player.cpp.

9725{
9726 if (sendtoset && isInGroup())
9727 getGroup()->SendPacketToAll(SmsgItemPushResult(getGuid(), recieved, created, destbagslot, destslot, entry, suffix, randomprop, count, stack).serialise().get());
9728 else
9729 m_session->SendPacket(SmsgItemPushResult(getGuid(), recieved, created, destbagslot, destslot, entry, suffix, randomprop, count, stack).serialise().get());
9730}
void SendPacketToAll(WorldPacket *packet)
Definition Group.h:180
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLevelupInfoPacket()

void Player::sendLevelupInfoPacket ( uint32_t  level,
uint32_t  hp,
uint32_t  mana,
uint32_t  stat0,
uint32_t  stat1,
uint32_t  stat2,
uint32_t  stat3,
uint32_t  stat4 
)

Definition at line 9719 of file Player.cpp.

9720{
9721 m_session->SendPacket(SmsgLevelupInfo(level, hp, mana, stat0, stat1, stat2, stat3, stat4).serialise().get());
9722}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLoginVerifyWorldPacket()

void Player::sendLoginVerifyWorldPacket ( uint32_t  mapId,
float  posX,
float  posY,
float  posZ,
float  orientation 
)

Definition at line 9699 of file Player.cpp.

9700{
9701 m_session->SendPacket(SmsgLoginVerifyWorld(mapId, LocationVector(posX, posY, posZ, orientation)).serialise().get());
9702}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLogXpGainPacket()

void Player::sendLogXpGainPacket ( uint64_t  guid,
uint32_t  normalXp,
uint32_t  restedXp,
bool  type 
)

Definition at line 12198 of file Player.cpp.

12199{
12200 m_session->SendPacket(SmsgLogXpGain(guid, normalXp, restedXp, type).serialise().get());
12201}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLoot()

void Player::sendLoot ( uint64_t  guid,
uint8_t  loot_type,
uint32_t  mapId 
)

Definition at line 10791 of file Player.cpp.

10792{
10793 if (!IsInWorld())
10794 return;
10795
10796 Loot* pLoot = nullptr;
10797
10798 WoWGuid wowGuid;
10799 wowGuid.Init(guid);
10800
10801 if (wowGuid.isUnit())
10802 {
10803 Creature* pCreature = getWorldMap()->getCreature(wowGuid.getGuidLowPart());
10804 if (!pCreature)return;
10805 pLoot = &pCreature->loot;
10806 m_currentLoot = pCreature->getGuid();
10807
10808 }
10809 else if (wowGuid.isGameObject())
10810 {
10812
10813 if (!go)
10814 {
10815 SmsgLootReleaseResponse(guid, 1);
10816 return;
10817 }
10818
10819 if (loot_type == LOOT_SKINNING)
10820 {
10821 // Disarm Trap
10822 if (!go->IsWithinDistInMap(this, 20.f))
10823 {
10824 SmsgLootReleaseResponse(guid, 1);
10825 return;
10826 }
10827 }
10828 else
10829 {
10830 if (loot_type != LOOT_FISHINGHOLE && ((loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_JUNK) || go->getCreatedByGuid() != getGuid()) && !go->IsWithinDistInMap(this, 30.0f))
10831 {
10832 SmsgLootReleaseResponse(guid, 1);
10833 return;
10834 }
10835
10836 if (loot_type == LOOT_CORPSE && go->getRespawnTime() && go->isSpawnedByDefault())
10837 {
10838 SmsgLootReleaseResponse(guid, 1);
10839 return;
10840 }
10841 }
10842
10843 GameObject_Lootable* pLGO = static_cast<GameObject_Lootable*>(go);
10844 pLoot = &pLGO->loot;
10845
10846 // loot was generated and respawntime has passed since then, allow to recreate loot
10847 // to avoid bugs, this rule covers spawned gameobjects only
10848 // Don't allow to regenerate chest loot inside instances and raids
10851
10852 if (go->getLootState() == GO_READY)
10853 {
10854 uint32_t lootid = go->GetGameObjectProperties()->getLootId();
10855 if (lootid)
10856 {
10857 pLoot->clear();
10858
10859 auto group = getGroup();
10861
10862 // check current RR player and get next if necessary
10863 if (groupRules)
10864 group->updateLooterGuid(go);
10865
10866 pLoot->fillLoot(lootid, sLootMgr.getGameobjectLoot(), this, false, static_cast<uint8_t>(pLGO->getLootMode()));
10867 pLGO->setLootGenerationTime();
10868
10869 // get next RR player (for next loot)
10870 if (groupRules && !pLoot->empty())
10871 group->updateLooterGuid(go);
10872 }
10873
10874 if (loot_type == LOOT_FISHING || loot_type == LOOT_FISHING_JUNK)
10875 pLGO->getFishLoot(this, loot_type == LOOT_FISHING_JUNK);
10876
10877 go->setLootState(GO_ACTIVATED, this);
10878
10879 // set Current Looter
10880 m_currentLoot = pLGO->getGuid();
10881 }
10882 }
10883 else if (wowGuid.isPlayer())
10884 {
10885 Player* p = getWorldMap()->getPlayer((uint32_t)guid);
10886 if (!p)
10887 return;
10888
10889 pLoot = &p->loot;
10890 m_currentLoot = p->getGuid();
10891 }
10892 else if (wowGuid.isCorpse())
10893 {
10894 if (const auto corpse = sObjectMgr.getCorpseByGuid(static_cast<uint32_t>(guid)))
10895 {
10896 pLoot = &corpse->loot;
10897 m_currentLoot = corpse->getGuid();
10898 }
10899 }
10900 else if (wowGuid.isItem())
10901 {
10902 Item* pItem = getItemInterface()->GetItemByGUID(guid);
10903 if (!pItem)
10904 return;
10905 pLoot = pItem->m_loot.get();
10906 m_currentLoot = pItem->getGuid();
10907 }
10908
10909 if (!pLoot)
10910 {
10911 // something whack happened.. damn cheaters..
10912 return;
10913 }
10914
10915 // add to looter set
10916 pLoot->addLooter(getGuidLow());
10917
10918 // Group case
10919 PartyLootMethod loot_method;
10920
10921 // Send Roll packets
10922 if (getGroup())
10923 {
10924 loot_method = PartyLootMethod(getGroup()->GetMethod());
10925
10926 switch (loot_method)
10927 {
10928 case PARTY_LOOT_GROUP:
10929 getGroup()->sendGroupLoot(pLoot, getWorldMap()->getObject(m_currentLoot), this, mapId);
10930 break;
10935 break;
10936 }
10937 }
10938 else
10939 {
10940 loot_method = PARTY_LOOT_FREE_FOR_ALL;
10941 }
10942
10943 m_lootGuid = guid;
10944
10945 WorldPacket data;
10947 data << uint64_t(guid);
10948 data << uint8_t(loot_type); //loot_type;
10949
10950
10951 data << uint32_t(pLoot->gold); // gold
10952 data << uint8_t(0); //loot size reserve
10953#if VERSION_STRING >= Cata
10954 data << uint8_t(0); // currency count reserve
10955#endif
10956
10957 uint32_t maxItemsCount = 0;
10958
10959 // Non Personal Items
10960 auto item = pLoot->items.begin();
10961 for (uint32_t nonpersonalItemsCount = 0; item != pLoot->items.end(); ++item, nonpersonalItemsCount++)
10962 {
10963 if (item->is_looted)
10964 continue;
10965
10966 if (item->is_ffa)
10967 continue;
10968
10970 if (loot_type < 2)
10971 {
10972 switch (loot_method)
10973 {
10975 {
10976 if (!item->is_looted && !item->is_ffa && item->isAllowedForPlayer(this))
10977 slottype = LOOT_SLOT_TYPE_MASTER;
10978 else
10979 // dont show item
10980 continue;
10981 }
10982 break;
10984 case PARTY_LOOT_GROUP:
10985 {
10986 if (item->is_blocked)
10987 slottype = LOOT_SLOT_TYPE_ROLL_ONGOING;
10988 else if (pLoot->roundRobinPlayer == 0 || !item->is_underthreshold || getGuid() == pLoot->roundRobinPlayer)
10989 slottype = LOOT_SLOT_TYPE_ALLOW_LOOT;
10990 else
10991 // dont show Item.
10992 continue;
10993 }
10994 break;
10996 {
10997 if (!item->is_looted && !item->is_ffa && item->isAllowedForPlayer(this))
10998 {
10999 if (pLoot->roundRobinPlayer != 0 && getGuid() != pLoot->roundRobinPlayer)
11000 // dont show Item.
11001 continue;
11002 }
11003 }
11004 break;
11005 default:
11006 slottype = LOOT_SLOT_TYPE_ALLOW_LOOT;
11007 break;
11008 }
11009 }
11010
11011 data << uint8_t(nonpersonalItemsCount);
11012 data << uint32_t(item->itemproto->ItemId);
11013 data << uint32_t(item->count); //nr of items of this type
11014 data << uint32_t(item->itemproto->DisplayInfoID);
11015
11016 if (item->iRandomSuffix)
11017 {
11018 data << uint32_t(Item::generateRandomSuffixFactor(item->itemproto));
11019 data << uint32_t(-int32_t(item->iRandomSuffix->id));
11020 }
11021 else if (item->iRandomProperty)
11022 {
11023 data << uint32_t(0);
11024 data << uint32_t(item->iRandomProperty->ID);
11025 }
11026 else
11027 {
11028 data << uint32_t(0);
11029 data << uint32_t(0);
11030 }
11031
11032 data << slottype; // "still being rolled for" flag
11033
11034 maxItemsCount++;
11035 }
11036
11037 uint32_t personalItemsCount = maxItemsCount;
11038
11039 // Quest Loot
11040 PersonaltemMap const& lootPlayerQuestItems = pLoot->getPlayerQuestItems();
11041 PersonaltemMap::const_iterator q_itr = lootPlayerQuestItems.find(getGuidLow());
11042 if (q_itr != lootPlayerQuestItems.end())
11043 {
11044 const auto& q_list = q_itr->second;
11045 for (auto qi = q_list->cbegin(); qi != q_list->cend(); ++qi, personalItemsCount++)
11046 {
11048
11049 LootItem& questItem = pLoot->quest_items[qi->index];
11050 if (!qi->is_looted && !questItem.is_looted && questItem.isAllowedForPlayer(this))
11051 {
11052 data << uint8_t(pLoot->items.size() + (qi - q_list->cbegin()));
11053 data << uint32_t(questItem.itemproto->ItemId);
11054 data << uint32_t(questItem.count); //nr of items of this type
11055 data << uint32_t(questItem.itemproto->DisplayInfoID);
11056
11057 if (questItem.iRandomSuffix)
11058 {
11060 data << uint32_t(-int32_t(questItem.iRandomSuffix->id));
11061 }
11062 else if (questItem.iRandomProperty)
11063 {
11064 data << uint32_t(0);
11065 data << uint32_t(questItem.iRandomProperty->ID);
11066 }
11067 else
11068 {
11069 data << uint32_t(0);
11070 data << uint32_t(0);
11071 }
11072
11073 data << slottype; // "still being rolled for" flag
11074 }
11075 maxItemsCount++;
11076 }
11077 }
11078
11079 uint32_t ffaItemsCount = maxItemsCount;
11080
11081 // Free for All
11082 PersonaltemMap const& lootPlayerFFAItems = pLoot->getPlayerFFAItems();
11083 PersonaltemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(getGuidLow());
11084 if (ffa_itr != lootPlayerFFAItems.end())
11085 {
11086 const auto& ffa_list = ffa_itr->second;
11087 for (auto fi = ffa_list->cbegin(); fi != ffa_list->cend(); ++fi, ffaItemsCount++)
11088 {
11090
11091 LootItem& ffaItem = pLoot->items[fi->index];
11092 if (!fi->is_looted && !ffaItem.is_looted && ffaItem.isAllowedForPlayer(this))
11093 {
11094 data << uint8_t(fi->index);
11095 data << uint32_t(ffaItem.itemproto->ItemId);
11096 data << uint32_t(ffaItem.count); //nr of items of this type
11097 data << uint32_t(ffaItem.itemproto->DisplayInfoID);
11098
11099 if (ffaItem.iRandomSuffix)
11100 {
11102 data << uint32_t(-int32_t(ffaItem.iRandomSuffix->id));
11103 }
11104 else if (ffaItem.iRandomProperty)
11105 {
11106 data << uint32_t(0);
11107 data << uint32_t(ffaItem.iRandomProperty->ID);
11108 }
11109 else
11110 {
11111 data << uint32_t(0);
11112 data << uint32_t(0);
11113 }
11114
11115 data << slottype; // "still being rolled for" flag
11116 }
11117 maxItemsCount++;
11118 }
11119 }
11120
11121 data.wpos(13);
11122 data << uint8_t(maxItemsCount);
11123
11124 m_session->SendPacket(&data);
11125
11127}
@ GO_ACTIVATED
@ GAMEOBJECT_TYPE_CHEST
@ LOOT_SLOT_TYPE_MASTER
@ LOOT_SLOT_TYPE_ROLL_ONGOING
@ LOOT_SLOT_TYPE_ALLOW_LOOT
PartyLootMethod
@ PARTY_LOOT_MASTER_LOOTER
@ PARTY_LOOT_ROUND_ROBIN
@ PARTY_LOOT_NEED_BEFORE_GREED
@ PARTY_LOOT_GROUP
@ PARTY_LOOT_FREE_FOR_ALL
std::map< uint32_t, std::unique_ptr< PersonaltemList > > PersonaltemMap
Definition Loot.hpp:32
@ SMSG_LOOT_RESPONSE
Definition Opcodes.hpp:397
@ LOOT_FISHING_JUNK
@ LOOT_CORPSE
@ LOOT_FISHING
@ LOOT_SKINNING
@ LOOT_FISHINGHOLE
@ UNIT_FLAG_LOOTING
bool isInstanceableMap() const
Definition BaseMap.cpp:124
size_t wpos()
Definition ByteBuffer.h:422
uint16_t getLootMode() const
void getFishLoot(Player *loot_owner, bool getJunk=false)
uint32_t getLootGenerationTime() const
uint32_t getRespawnDelay() const
Definition GameObject.h:69
LootState getLootState() const
uint64_t getCreatedByGuid() const
time_t getRespawnTime() const
Definition GameObject.h:66
bool isSpawnedByDefault() const
Definition GameObject.h:77
GameObjectProperties const * GetGameObjectProperties() const
void setLootState(LootState state, Unit *unit=nullptr)
void sendGroupLoot(Loot *loot, Object *object, Player *plr, uint32_t mapId)
Definition Group.cpp:1423
static uint32_t generateRandomSuffixFactor(ItemProperties const *m_itemProto)
Definition Item.cpp:735
std::unique_ptr< Loot > m_loot
Definition Item.hpp:256
uint64_t m_currentLoot
Definition Player.hpp:1649
bool isCorpse() const
Definition WoWGuid.h:291
void SetOpcode(uint16_t opcode)
Definition WorldPacket.h:28
struct GameObjectProperties::@162::@167 chest
uint8_t count
Definition LootItem.hpp:58
bool isAllowedForPlayer(Player const *player) const
Definition LootItem.cpp:60
WDB::Structures::ItemRandomPropertiesEntry const * iRandomProperty
Definition LootItem.hpp:60
bool is_looted
Definition LootItem.hpp:74
WDB::Structures::ItemRandomSuffixEntry const * iRandomSuffix
Definition LootItem.hpp:62
ItemProperties const * itemproto
Definition LootItem.hpp:56
bool fillLoot(uint32_t lootId, LootTemplateMap const &tempelateStore, Player *lootOwner, bool personal, uint8_t lootMode=InstanceDifficulty::DUNGEON_NORMAL)
Definition Loot.cpp:30
bool empty() const
Definition Loot.hpp:62
bool isLooted() const
Definition Loot.hpp:65
void clear()
Definition Loot.cpp:125
uint64_t roundRobinPlayer
Definition Loot.hpp:44
PersonaltemMap const & getPlayerFFAItems() const
Definition Loot.hpp:37
void addLooter(uint32_t GUID)
Definition Loot.hpp:68
PersonaltemMap const & getPlayerQuestItems() const
Definition Loot.hpp:36
std::vector< LootItem > items
Definition Loot.hpp:39
std::vector< LootItem > quest_items
Definition Loot.hpp:40
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLooter()

void Player::sendLooter ( Creature creature)

Definition at line 11154 of file Player.cpp.

11155{
11156 WorldPacket data(SMSG_LOOT_LIST, 8 + 1 + 1);
11157 data << uint64_t(creature->getGuid());
11158 data << uint8_t(0); // unk1
11159 data << uint8_t(0); // no group looter
11160 sendMessageToSet(&data, true);
11161}
@ SMSG_LOOT_LIST
Definition Opcodes.hpp:1100
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLootUpdate()

void Player::sendLootUpdate ( Object object)

Definition at line 11129 of file Player.cpp.

11130{
11131 if (!isVisibleObject(object->getGuid()))
11132 return;
11133
11134 if (object->isCreatureOrPlayer())
11135 {
11136 // Build the actual update.
11137 ByteBuffer buffer(500);
11138
11139 uint32_t flags = dynamic_cast<Unit*>(object)->getDynamicFlags();
11140
11141 flags |= U_DYN_FLAG_LOOTABLE;
11143
11144#if VERSION_STRING < Mop
11145 object->BuildFieldUpdatePacket(&buffer, getOffsetForStructuredField(WoWUnit, dynamic_flags), flags);
11146#else
11147 object->BuildFieldUpdatePacket(&buffer, getOffsetForStructuredField(WoWObject, dynamic_field), flags);
11148#endif
11149
11151 }
11152}
@ U_DYN_FLAG_TAPPED_BY_PLAYER
bool isCreatureOrPlayer() const
Definition Object.cpp:568
uint16_t getDynamicFlags() const
Definition Object.cpp:386
void pushUpdateData(ByteBuffer *data, uint32_t updateCount)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendMeetingStoneSetQueuePacket()

void Player::sendMeetingStoneSetQueuePacket ( uint32_t  dungeonId,
uint8_t  status 
)

Definition at line 9656 of file Player.cpp.

Here is the call graph for this function:

◆ sendMessageToSet()

void Player::sendMessageToSet ( WorldPacket data,
bool  sendToSelf,
bool  sendToOwnTeam = false 
)
overridevirtual

Reimplemented from Object.

Definition at line 3192 of file Player.cpp.

3193{
3194 if (!IsInWorld())
3195 return;
3196
3197 if (sendToSelf)
3198 sendPacket(data);
3199
3200 for (const auto& objectPlayer : getInRangePlayersSet())
3201 {
3202 if (Player* player = static_cast<Player*>(objectPlayer))
3203 {
3204 if (player->getSession() == nullptr)
3205 continue;
3206
3207 if (sendToOwnTeam && player->getTeam() != getTeam())
3208 continue;
3209
3210 if ((player->GetPhase() & GetPhase()) == 0)
3211 continue;
3212
3213 if (data->GetOpcode() != SMSG_MESSAGECHAT)
3214 {
3215 if (m_isGmInvisible && !player->getSession()->hasPermissions())
3216 continue;
3217
3218 if (player->isVisibleObject(getGuid()))
3219 player->sendPacket(data);
3220 }
3221 else
3222 {
3223 if (!player->isIgnored(getGuidLow()))
3224 player->sendPacket(data);
3225 }
3226 }
3227 }
3228}
@ SMSG_MESSAGECHAT
Definition Opcodes.hpp:187
uint16_t GetOpcode() const
Definition WorldPacket.h:27
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendMirrorTimer()

void Player::sendMirrorTimer ( MirrorTimerTypes  mirrorType,
uint32_t  max,
uint32_t  current,
int32_t  regen 
)

Definition at line 16157 of file Player.cpp.

16158{
16159 if (static_cast<int>(max) == -1)
16160 {
16161 if (static_cast<int>(current) != -1)
16162 sendStopMirrorTimerPacket(mirrorType);
16163
16164 return;
16165 }
16166
16167 getSession()->SendPacket(SmsgStartMirrorTimer(mirrorType, current, max, regen).serialise().get());
16168}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendMountResultPacket()

void Player::sendMountResultPacket ( uint32_t  result)

Definition at line 9704 of file Player.cpp.

9705{
9706 m_session->SendPacket(SmsgMountResult(result).serialise().get());
9707}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendMoveSetSpeedPaket()

void Player::sendMoveSetSpeedPaket ( UnitSpeedType  speed_type,
float  speed 
)

Definition at line 1385 of file Player.cpp.

1386{
1387 WorldPacket data;
1388 ObjectGuid guid = getGuid();
1389
1390 switch (speed_type)
1391 {
1392 case TYPE_WALK:
1393 {
1394 data.Initialize(MSG_MOVE_SET_WALK_SPEED, 1 + 8 + 4 + 4);
1396 break;
1397 }
1398 case TYPE_RUN:
1399 {
1400 data.Initialize(MSG_MOVE_SET_RUN_SPEED, 1 + 8 + 4 + 4);
1401#if VERSION_STRING == Mop
1402 data.writeBit(guid[1]);
1403 data.writeBit(guid[7]);
1404 data.writeBit(guid[4]);
1405 data.writeBit(guid[2]);
1406 data.writeBit(guid[5]);
1407 data.writeBit(guid[3]);
1408 data.writeBit(guid[6]);
1409 data.writeBit(guid[0]);
1410
1411 data.WriteByteSeq(guid[1]);
1412
1413 data << uint32_t(0);
1414
1415 data.WriteByteSeq(guid[7]);
1416 data.WriteByteSeq(guid[3]);
1417 data.WriteByteSeq(guid[0]);
1418
1419 data << float(speed);
1420
1421 data.WriteByteSeq(guid[2]);
1422 data.WriteByteSeq(guid[4]);
1423 data.WriteByteSeq(guid[6]);
1424 data.WriteByteSeq(guid[5]);
1425#else
1427#endif
1428 break;
1429 }
1430 case TYPE_RUN_BACK:
1431 {
1432 data.Initialize(MSG_MOVE_SET_RUN_BACK_SPEED, 1 + 8 + 4 + 4);
1434 break;
1435 }
1436 case TYPE_SWIM:
1437 {
1438 data.Initialize(MSG_MOVE_SET_SWIM_SPEED, 1 + 8 + 4 + 4);
1440 break;
1441 }
1442 case TYPE_SWIM_BACK:
1443 {
1444 data.Initialize(MSG_MOVE_SET_SWIM_BACK_SPEED, 1 + 8 + 4 + 4);
1446 break;
1447 }
1448 case TYPE_TURN_RATE:
1449 {
1450 data.Initialize(MSG_MOVE_SET_TURN_RATE, 1 + 8 + 4 + 4);
1452 break;
1453 }
1454 case TYPE_FLY:
1455 {
1456 data.Initialize(MSG_MOVE_SET_FLIGHT_SPEED, 1 + 8 + 4 + 4);
1457#if VERSION_STRING == Mop
1458 data << float(speed);
1459 data << uint32_t(0);
1460
1461 data.writeBit(guid[6]);
1462 data.writeBit(guid[5]);
1463 data.writeBit(guid[0]);
1464 data.writeBit(guid[4]);
1465 data.writeBit(guid[1]);
1466 data.writeBit(guid[7]);
1467 data.writeBit(guid[3]);
1468 data.writeBit(guid[2]);
1469
1470 data.WriteByteSeq(guid[0]);
1471 data.WriteByteSeq(guid[7]);
1472 data.WriteByteSeq(guid[4]);
1473 data.WriteByteSeq(guid[5]);
1474 data.WriteByteSeq(guid[6]);
1475 data.WriteByteSeq(guid[2]);
1476 data.WriteByteSeq(guid[3]);
1477 data.WriteByteSeq(guid[1]);
1478#else
1480#endif
1481 break;
1482 }
1483 case TYPE_FLY_BACK:
1484 {
1485 data.Initialize(MSG_MOVE_SET_FLIGHT_BACK_SPEED, 1 + 8 + 4 + 4);
1487 break;
1488 }
1489 case TYPE_PITCH_RATE:
1490 {
1491 data.Initialize(MSG_MOVE_SET_PITCH_RATE, 1 + 8 + 4 + 4);
1493 break;
1494 }
1495 }
1496
1497 sendMessageToSet(&data, true);
1498}
@ MSG_MOVE_SET_SWIM_BACK_SPEED
Definition Opcodes.hpp:255
@ MSG_MOVE_SET_TURN_RATE
Definition Opcodes.hpp:259
@ MSG_MOVE_SET_PITCH_RATE
Definition Opcodes.hpp:1247
@ MSG_MOVE_SET_RUN_SPEED
Definition Opcodes.hpp:243
@ MSG_MOVE_SET_FLIGHT_SPEED
Definition Opcodes.hpp:975
@ MSG_MOVE_SET_WALK_SPEED
Definition Opcodes.hpp:249
@ MSG_MOVE_SET_SWIM_SPEED
Definition Opcodes.hpp:252
@ MSG_MOVE_SET_FLIGHT_BACK_SPEED
Definition Opcodes.hpp:977
@ MSG_MOVE_SET_RUN_BACK_SPEED
Definition Opcodes.hpp:246
void WriteByteSeq(uint8_t b)
Definition ByteBuffer.h:182
bool writeBit(uint32_t bit)
Definition ByteBuffer.h:103
void Initialize(uint16_t opcode, size_t newres=200)
Definition WorldPacket.h:20
Here is the call graph for this function:

◆ sendMovie()

void Player::sendMovie ( uint32_t  movieId)

Definition at line 9386 of file Player.cpp.

9387{
9388#if VERSION_STRING > TBC
9389 m_session->SendPacket(SmsgTriggerMovie(movieId).serialise().get());
9390#endif
9391}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendNewDrunkStatePacket()

void Player::sendNewDrunkStatePacket ( uint32_t  state,
uint32_t  itemId 
)

Definition at line 9596 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendPacket()

void Player::sendPacket ( WorldPacket packet)
overridevirtual

Reimplemented from Object.

Definition at line 3161 of file Player.cpp.

3162{
3163 if (m_session)
3164 m_session->SendPacket(packet);
3165}
Here is the call graph for this function:

◆ sendPartyKillLogPacket()

void Player::sendPartyKillLogPacket ( uint64_t  killedGuid)

Definition at line 9606 of file Player.cpp.

9607{
9608 sendMessageToSet(SmsgPartyKillLog(getGuid(), killedGuid).serialise().get(), true);
9609}
Here is the call graph for this function:

◆ sendPetTameFailure()

void Player::sendPetTameFailure ( uint8_t  result) const

Definition at line 9628 of file Player.cpp.

9629{
9631 data << uint8_t(result);
9632 m_session->SendPacket(&data);
9633}
@ SMSG_PET_TAME_FAILURE
Definition Opcodes.hpp:416
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendPetUnlearnConfirmPacket()

void Player::sendPetUnlearnConfirmPacket ( )

Definition at line 9560 of file Player.cpp.

9561{
9562 if (getPet() == nullptr)
9563 return;
9564
9565#if VERSION_STRING < Mop
9566 m_session->SendPacket(SmsgPetUnlearnConfirm(getPet()->getGuid(), getPet()->getUntrainCost()).serialise().get());
9567#else
9568 m_session->SendPacket(SmsgPetUnlearnConfirm(getPet()->getGuid(), 0).serialise().get());
9569#endif
9570}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendPlayObjectSoundPacket()

void Player::sendPlayObjectSoundPacket ( uint64_t  objectGuid,
uint32_t  soundId 
)

Definition at line 9661 of file Player.cpp.

9662{
9663 sendMessageToSet(SmsgPlayObjectSound(soundId, objectGuid).serialise().get(), true);
9664}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendPlaySoundPacket()

void Player::sendPlaySoundPacket ( uint32_t  soundId)

Definition at line 9666 of file Player.cpp.

9667{
9668 m_session->SendPacket(SmsgPlaySound(soundId).serialise().get());
9669}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendPoiById()

void Player::sendPoiById ( uint32_t  id)

Definition at line 9640 of file Player.cpp.

9641{
9642 if (const auto pPoi = sMySQLStore.getPointOfInterest(id))
9643 {
9644 const auto loc = (m_session->language > 0) ? sMySQLStore.getLocalizedPointsOfInterest(id, m_session->language) : nullptr;
9645 const auto name = loc ? loc->iconName : pPoi->iconName;
9646
9647 sendGossipPoiPacket(pPoi->x, pPoi->y, pPoi->icon, pPoi->flags, pPoi->data, name);
9648 }
9649}
void sendGossipPoiPacket(float posX, float posY, uint32_t icon, uint32_t flags, uint32_t data, std::string name)
Definition Player.cpp:9635
uint32_t language
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendPreventSchoolCast()

void Player::sendPreventSchoolCast ( uint32_t  spellSchool,
uint32_t  timeMs 
)

Definition at line 4014 of file Player.cpp.

4015{
4016 std::vector<SmsgSpellCooldownMap> spellCoodlownMap;
4017
4018 for (const auto& SpellId : m_spellSet)
4019 {
4020 if (const auto* spellInfo = sSpellMgr.getSpellInfo(SpellId))
4021 {
4022 // Not send cooldown for this spells
4023 if (spellInfo->getAttributes() & ATTRIBUTES_TRIGGER_COOLDOWN)
4024 continue;
4025
4026 if (spellInfo->getFirstSchoolFromSchoolMask() == spellSchool)
4027 {
4028 SmsgSpellCooldownMap smsgSpellCooldownMap;
4029 smsgSpellCooldownMap.spellId = SpellId;
4030 smsgSpellCooldownMap.duration = timeMs;
4031
4032 spellCoodlownMap.push_back(smsgSpellCooldownMap);
4033 }
4034 }
4035 }
4036 getSession()->SendPacket(SmsgSpellCooldown(getGuid(), 0x0, spellCoodlownMap).serialise().get());
4037}
@ ATTRIBUTES_TRIGGER_COOLDOWN
Here is the call graph for this function:

◆ sendPvpCredit()

void Player::sendPvpCredit ( uint32_t  honor,
uint64_t  victimGuid,
uint32_t  victimRank 
)

Definition at line 9885 of file Player.cpp.

9886{
9887 this->sendPacket(SmsgPvpCredit(honor, victimGuid, victimRank).serialise().get());
9888}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendRaidDifficultyPacket()

void Player::sendRaidDifficultyPacket ( )

Definition at line 9577 of file Player.cpp.

9578{
9579#if VERSION_STRING > TBC
9581#endif
9582}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendRaidGroupOnly()

void Player::sendRaidGroupOnly ( uint32_t  timeInMs,
uint32_t  type 
)

Definition at line 9890 of file Player.cpp.

9891{
9892 this->sendPacket(SmsgRaidGroupOnly(timeInMs, type).serialise().get());
9893}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendRaidInfo()

void Player::sendRaidInfo ( )

Definition at line 12927 of file Player.cpp.

12928{
12929 uint32_t counter = 0;
12930
12932
12933 size_t p_counter = data.wpos();
12934 data << uint32_t(counter);
12935
12936 const auto now = Util::getTimeNow();
12937
12938 for (uint8_t i = 0; i < InstanceDifficulty::MAX_DIFFICULTY; ++i)
12939 {
12940 for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
12941 {
12942 InstancePlayerBind const& bind = itr->second;
12943 if (bind.perm)
12944 {
12945 InstanceSaved* save = bind.save;
12946 data << uint32_t(save->getMapId());
12947#if VERSION_STRING > TBC
12948 data << uint32_t(save->getDifficulty());
12949 data << uint64_t(save->getInstanceId());
12950 data << uint8_t(bind.extendState != EXTEND_STATE_EXPIRED);
12951 data << uint8_t(bind.extendState == EXTEND_STATE_EXTENDED);
12952
12953 time_t nextReset = save->getResetTime();
12955 nextReset = sInstanceMgr.getSubsequentResetTime(save->getMapId(), save->getDifficulty(), save->getResetTime());
12956
12957 data << uint32_t(nextReset - now);
12958#else
12959 time_t nextReset = save->getResetTime();
12961 nextReset = sInstanceMgr.getSubsequentResetTime(save->getMapId(), save->getDifficulty(), save->getResetTime());
12962
12963 data << uint32_t(nextReset - now);
12964
12965 data << uint32_t(save->getInstanceId());
12966 data << uint32_t(counter);
12967#endif
12968
12969 ++counter;
12970 }
12971 }
12972 }
12973 data.put<uint32_t>(p_counter, counter);
12974 sendPacket(&data);
12975}
@ EXTEND_STATE_EXTENDED
@ EXTEND_STATE_EXPIRED
@ SMSG_RAID_INSTANCE_INFO
Definition Opcodes.hpp:783
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendReportToGmMessage()

void Player::sendReportToGmMessage ( std::string  playerName,
std::string  damageLog 
)

Definition at line 6537 of file Player.cpp.

6538{
6539 std::string gm_ann(MSG_COLOR_GREEN);
6540
6541 gm_ann += "|HPlayer:";
6542 gm_ann += playerName;
6543 gm_ann += "|h[";
6544 gm_ann += playerName;
6545 gm_ann += "]|h: ";
6546 gm_ann += MSG_COLOR_YELLOW;
6547 gm_ann += damageLog;
6548
6549 sWorld.sendMessageToOnlineGms(gm_ann);
6550}
#define MSG_COLOR_YELLOW
#define MSG_COLOR_GREEN
Here is the caller graph for this function:

◆ sendResetFailedNotify()

void Player::sendResetFailedNotify ( uint32_t  mapid)

Definition at line 9584 of file Player.cpp.

9585{
9587 data << uint32_t(mapid);
9588 sendPacket(&data);
9589}
@ SMSG_RESET_FAILED_NOTIFY
Definition Opcodes.hpp:1000
Here is the call graph for this function:

◆ sendResetInstanceFailed()

void Player::sendResetInstanceFailed ( uint32_t  reason,
uint32_t  MapId 
)

Definition at line 13094 of file Player.cpp.

13095{
13096 // reasons for instance reset failure:
13097 // 0: There are players inside the instance.
13098 // 1: There are players offline in your party.
13099 // 2: There are players in your party attempting to zone into an instance.
13101 data << uint32_t(reason);
13102 data << uint32_t(MapId);
13103 sendPacket(&data);
13104}
@ SMSG_INSTANCE_RESET_FAILED
Definition Opcodes.hpp:870
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSavedInstances()

void Player::sendSavedInstances ( )

Definition at line 12977 of file Player.cpp.

12978{
12979 bool hasBeenSaved = false;
12980 WorldPacket data;
12981
12982 for (uint8_t i = 0; i < InstanceDifficulty::MAX_DIFFICULTY; ++i)
12983 {
12984 for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
12985 {
12986 if (itr->second.perm)
12987 {
12988 hasBeenSaved = true;
12989 break;
12990 }
12991 }
12992 }
12993
12994 // true or false means, whether you have current raid/heroic instances
12996 data << uint32_t(hasBeenSaved);
12997 sendPacket(&data);
12998
12999 if (!hasBeenSaved)
13000 return;
13001
13002 for (uint8_t i = 0; i < InstanceDifficulty::MAX_DIFFICULTY; ++i)
13003 {
13004 for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
13005 {
13006 if (itr->second.perm)
13007 {
13009 data << uint32_t(itr->second.save->getMapId());
13010 sendPacket(&data);
13011 }
13012 }
13013 }
13014}
@ SMSG_UPDATE_INSTANCE_OWNERSHIP
Definition Opcodes.hpp:892
@ SMSG_UPDATE_LAST_INSTANCE
Definition Opcodes.hpp:871
Here is the call graph for this function:

◆ sendSetProficiencyPacket()

void Player::sendSetProficiencyPacket ( uint8_t  itemClass,
uint32_t  proficiency 
)

Definition at line 9601 of file Player.cpp.

9602{
9603 m_session->SendPacket(SmsgSetProficiency(itemClass, proficiency).serialise().get());
9604}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSmsgInitialFactions()

void Player::sendSmsgInitialFactions ( )

Definition at line 11762 of file Player.cpp.

11763{
11764#if VERSION_STRING == Mop
11765 const uint16_t factionCount = 256;
11767 uint32_t a = 0;
11768
11769 WorldPacket data(SMSG_INITIALIZE_FACTIONS, factionCount * (1 + 4) + 32);
11770 for (; a != factionCount; ++a)
11771 {
11772 data << uint8_t(0);
11773 data << uint32_t(0);
11774 buffer.writeBit(0);
11775 }
11776
11777 buffer.flushBits();
11778
11779 data.append(buffer);
11780#else
11782 data << uint32_t(128);
11783
11784 for (auto& i : m_reputationByListId)
11785 {
11786 FactionReputation* factionReputation = i;
11787 if (!factionReputation)
11788 {
11789 data << uint8_t(0);
11790 data << uint32_t(0);
11791 }
11792 else
11793 {
11794 data << factionReputation->flag;
11795 data << factionReputation->CalcStanding();
11796 }
11797 }
11798
11799#endif
11800 m_session->SendPacket(&data);
11801}
@ SMSG_INITIALIZE_FACTIONS
Definition Opcodes.hpp:334
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSmsgInitialSpells()

void Player::sendSmsgInitialSpells ( )

Definition at line 3970 of file Player.cpp.

3971{
3972 auto smsgInitialSpells = SmsgSendKnownSpells();
3973
3974 uint32_t mstime = Util::getMSTime();
3975
3976 for (const auto& spellId : m_spellSet)
3977 {
3978 smsgInitialSpells.addSpellIds(spellId);
3979 }
3980
3981 for (auto itr = m_cooldownMap[COOLDOWN_TYPE_SPELL].begin(); itr != m_cooldownMap[COOLDOWN_TYPE_SPELL].end();)
3982 {
3983 auto itr2 = itr++;
3984
3985 if (itr2->second.ExpireTime < mstime || (itr2->second.ExpireTime - mstime) < 10000)
3986 {
3988 continue;
3989 }
3990
3991 sLogger.debug("InitialSpells sending spell cooldown for spell {} to {} ms", itr2->first, itr2->second.ExpireTime - mstime);
3992
3993 smsgInitialSpells.addSpellCooldown(itr2->first, itr2->second.ItemId, 0, itr2->second.ExpireTime - mstime, 0);
3994 }
3995
3996 for (auto itr = m_cooldownMap[COOLDOWN_TYPE_CATEGORY].begin(); itr != m_cooldownMap[COOLDOWN_TYPE_CATEGORY].end();)
3997 {
3998 PlayerCooldownMap::iterator itr2 = itr++;
3999
4000 if (itr2->second.ExpireTime < mstime || (itr2->second.ExpireTime - mstime) < 10000)
4001 {
4003 continue;
4004 }
4005
4006 sLogger.debug("InitialSpells sending category cooldown for cat {} to {} ms", itr2->first, itr2->second.ExpireTime - mstime);
4007
4008 smsgInitialSpells.addSpellCooldown(itr2->first, itr2->second.ItemId, static_cast<uint16_t>(itr2->first), 0, itr2->second.ExpireTime - mstime);
4009 }
4010
4011 getSession()->SendPacket(smsgInitialSpells.serialise().get());
4012}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSpellCooldownEventPacket()

void Player::sendSpellCooldownEventPacket ( uint32_t  spellId)

Definition at line 9676 of file Player.cpp.

9677{
9678 m_session->SendPacket(SmsgCooldownEvent(spellId, getGuid()).serialise().get());
9679}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSpellCooldownPacket()

void Player::sendSpellCooldownPacket ( SpellInfo const spellInfo,
const uint32_t  duration,
const bool  isGcd 
)

Definition at line 4409 of file Player.cpp.

4410{
4411 std::vector<SmsgSpellCooldownMap> spellMap;
4412
4413 SmsgSpellCooldownMap mapMembers;
4414 mapMembers.spellId = spellInfo->getId();
4415 mapMembers.duration = duration;
4416
4417 spellMap.push_back(mapMembers);
4418
4419 sendMessageToSet(SmsgSpellCooldown(GetNewGUID(), isGcd, spellMap).serialise().get(), true);
4420}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSpellModifierPacket()

void Player::sendSpellModifierPacket ( uint8_t  spellType,
std::vector< std::pair< uint8_t, float > >  modValues,
bool  isPct 
)

Definition at line 9690 of file Player.cpp.

9691{
9692 if (isPct)
9693 m_session->SendPacket(SmsgSetPctSpellModifier(spellType, modValues).serialise().get());
9694 else
9695 m_session->SendPacket(SmsgSetFlatSpellModifier(spellType, modValues).serialise().get());
9696}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendStopMirrorTimerPacket()

void Player::sendStopMirrorTimerPacket ( MirrorTimerTypes  type)

Definition at line 9651 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSummonRequest()

void Player::sendSummonRequest ( uint32_t  requesterId,
uint32_t  zoneId,
uint32_t  mapId,
uint32_t  instanceId,
const LocationVector position 
)

Definition at line 2386 of file Player.cpp.

2387{
2388 m_summonData.instanceId = instanceId;
2389 m_summonData.position = position;
2390 m_summonData.summonerId = requesterId;
2391 m_summonData.mapId = mapId;
2392
2393 m_session->SendPacket(SmsgSummonRequest(requesterId, zoneId, 120000).serialise().get());
2394}
SummonData m_summonData
Definition Player.hpp:1117
uint32_t instanceId
Definition Player.hpp:1114
LocationVector position
Definition Player.hpp:1115
uint32_t summonerId
Definition Player.hpp:1112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTalentResetConfirmPacket()

void Player::sendTalentResetConfirmPacket ( )

Definition at line 9555 of file Player.cpp.

9556{
9558}
uint32_t calcTalentResetCost(uint32_t resetnum) const
Definition Player.cpp:6321
uint32_t getTalentResetsCount() const
Definition Player.cpp:6318
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTaxiNodeStatusMultiple()

void Player::sendTaxiNodeStatusMultiple ( )

Definition at line 10748 of file Player.cpp.

10749{
10750 for (const auto& itr : getInRangeObjectsSet())
10751 {
10752 if (!itr->isCreature())
10753 continue;
10754
10755 Creature* creature = itr->ToCreature();
10756 if (!creature || creature->isHostileTo(this))
10757 continue;
10758
10759 if (!creature->isTaxi())
10760 continue;
10761
10762 const auto nearestNode = sTaxiMgr.getNearestTaxiNode(creature->GetPosition(), creature->GetMapId(), GetTeam());
10763 if (nearestNode == 0)
10764 continue;
10765
10766 getSession()->SendPacket(SmsgTaxinodeStatus(creature->getGuid(), m_taxi->isTaximaskNodeKnown(nearestNode)).serialise().get());
10767 }
10768}
bool isTaxi() const
Definition Creature.cpp:259
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTeleportAckPacket()

void Player::sendTeleportAckPacket ( LocationVector  position)

Definition at line 1957 of file Player.cpp.

1958{
1960
1961#if VERSION_STRING < TBC
1963 data << GetNewGUID();
1964 data << uint32_t(2);
1965 data << uint32_t(0);
1966 data << uint8_t(0);
1967
1968 data << float(0);
1969 data << position.x;
1970 data << position.y;
1971 data << position.z;
1972 data << position.o;
1973 data << uint16_t(2);
1974 data << uint8_t(0);
1975#else
1977 data << GetNewGUID();
1978 data << uint32_t(0);
1979 buildMovementPacket(&data, position.x, position.y, position.z, position.o);
1980#endif
1981 getSession()->SendPacket(&data);
1982
1983#if VERSION_STRING == TBC
1984 sendTeleportPacket(position);
1985#endif
1986
1987}
@ MSG_MOVE_TELEPORT_ACK
Definition Opcodes.hpp:236
void buildMovementPacket(ByteBuffer *data)
Definition Unit.cpp:8801
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTeleportPacket()

void Player::sendTeleportPacket ( LocationVector  position)

Definition at line 1895 of file Player.cpp.

1896{
1897#if VERSION_STRING < Cata
1898 WorldPacket data2(MSG_MOVE_TELEPORT, 38);
1899 data2.append(GetNewGUID());
1900 buildMovementPacket(&data2, position.x, position.y, position.z, position.o);
1901 sendMessageToSet(&data2, false);
1902 SetPosition(position);
1903#else
1905 LocationVector pos = position;
1906
1908 SetPosition(pos);
1909
1910 ObjectGuid guid = getGuid();
1911
1914
1916 {
1917 WorldPacket data2(MSG_MOVE_TELEPORT, 38);
1918 data2.writeBit(guid[6]);
1919 data2.writeBit(guid[0]);
1920 data2.writeBit(guid[3]);
1921 data2.writeBit(guid[2]);
1922 data2.writeBit(0); // unk
1923 //\TODO add transport
1924 data2.writeBit(uint64_t(0)); // transport guid
1925 data2.writeBit(guid[1]);
1926
1927 data2.writeBit(guid[4]);
1928 data2.writeBit(guid[7]);
1929 data2.writeBit(guid[5]);
1930 data2.flushBits();
1931
1932 data2 << uint32_t(0); // unk
1933 data2.WriteByteSeq(guid[1]);
1934 data2.WriteByteSeq(guid[2]);
1935 data2.WriteByteSeq(guid[3]);
1936 data2.WriteByteSeq(guid[5]);
1937 data2 << float(GetPositionX());
1938 data2.WriteByteSeq(guid[4]);
1939 data2 << float(GetOrientation());
1940 data2.WriteByteSeq(guid[7]);
1941 data2 << float(GetPositionZ());
1942 data2.WriteByteSeq(guid[0]);
1943 data2.WriteByteSeq(guid[6]);
1944 data2 << float(GetPositionY());
1945 sendPacket(&data2);
1946 }
1947
1949 SetPosition(pos);
1950 else
1951 SetPosition(oldPos);
1952
1953 sendMessageToSet(&data, false);
1954#endif
1955}
@ TYPEID_UNIT
@ SMSG_MOVE_UPDATE_TELEPORT
Definition Opcodes.hpp:1693
@ MSG_MOVE_TELEPORT
Definition Opcodes.hpp:234
uint8_t getObjectTypeId() const
Definition Object.cpp:566
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTimeSync()

void Player::sendTimeSync ( )

Definition at line 10322 of file Player.cpp.

10323{
10325
10326 // Schedule next sync in 10 sec
10327 m_timeSyncTimer = 10000;
10329}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTotemCreatedPacket()

void Player::sendTotemCreatedPacket ( uint8_t  slot,
uint64_t  guid,
uint32_t  duration,
uint32_t  spellId 
)

Definition at line 9623 of file Player.cpp.

9624{
9625 m_session->SendPacket(SmsgTotemCreated(slot, guid, duration, spellId).serialise().get());
9626}
Here is the call graph for this function:

◆ sendUpdateDataToSet()

void Player::sendUpdateDataToSet ( ByteBuffer groupBuf,
ByteBuffer nonGroupBuf,
bool  sendToSelf 
)

Definition at line 10172 of file Player.cpp.

10173{
10174 if (groupBuf && nonGroupBuf)
10175 {
10176 for (const auto& object : getInRangePlayersSet())
10177 {
10178 if (Player* player = static_cast<Player*>(object))
10179 {
10180 if (player->getGroup() && getGroup() && player->getGroup()->GetID() == getGroup()->GetID())
10181 player->getUpdateMgr().pushUpdateData(groupBuf, 1);
10182 else
10183 player->getUpdateMgr().pushUpdateData(nonGroupBuf, 1);
10184 }
10185 }
10186 }
10187 else
10188 {
10189 if (groupBuf && nonGroupBuf == nullptr)
10190 {
10191 for (const auto& object : getInRangePlayersSet())
10192 {
10193 if (Player* player = static_cast<Player*>(object))
10194 if (player->getGroup() && getGroup() && player->getGroup()->GetID() == getGroup()->GetID())
10195 player->getUpdateMgr().pushUpdateData(groupBuf, 1);
10196 }
10197 }
10198 else
10199 {
10200 if (groupBuf == nullptr && nonGroupBuf)
10201 {
10202 for (const auto& object : getInRangePlayersSet())
10203 {
10204 if (Player* player = static_cast<Player*>(object))
10205 if (player->getGroup() == nullptr || player->getGroup()->GetID() != getGroup()->GetID())
10206 player->getUpdateMgr().pushUpdateData(nonGroupBuf, 1);
10207 }
10208 }
10209 }
10210 }
10211
10212 if (sendToSelf && groupBuf != nullptr)
10213 getUpdateMgr().pushUpdateData(groupBuf, 1);
10214}
uint32_t GetID()
Definition Group.h:223
Here is the call graph for this function:

◆ sendUpdateToOutOfRangeGroupMembers()

void Player::sendUpdateToOutOfRangeGroupMembers ( )

Definition at line 7933 of file Player.cpp.

7934{
7936 return;
7937
7938 if (auto group = getGroup())
7939 group->UpdateOutOfRangePlayer(this, true, nullptr);
7940
7942
7943 if (Pet* pet = getPet())
7944 pet->resetAuraUpdateMaskForRaid();
7945}
Definition Pet.h:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendWorldStateUpdate()

void Player::sendWorldStateUpdate ( uint32_t  worldState,
uint32_t  value 
)

Definition at line 10216 of file Player.cpp.

10217{
10218 m_session->SendPacket(SmsgUpdateWorldState(worldState, value).serialise().get());
10219}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActionButton()

void Player::setActionButton ( uint8_t  button,
uint32_t  action,
uint8_t  type,
uint8_t  misc 
)

Definition at line 6374 of file Player.cpp.

6375{
6376 if (button >= PLAYER_ACTION_BUTTON_COUNT)
6377 return;
6378
6379 getActiveSpec().getActionButton(button).Action = action;
6380 getActiveSpec().getActionButton(button).Misc = misc;
6382}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAFKReason()

void Player::setAFKReason ( std::string  reason)

Definition at line 2396 of file Player.cpp.

2396{ afkReason = reason; }
Here is the caller graph for this function:

◆ setAllowedToCreateCorpse()

void Player::setAllowedToCreateCorpse ( bool  allowed)

Definition at line 7435 of file Player.cpp.

7436{
7437 m_isCorpseCreationAllowed = allowed;
7438}
Here is the caller graph for this function:

◆ setAreaSpiritHealerGuid()

void Player::setAreaSpiritHealerGuid ( uint64_t  guid)

Definition at line 7782 of file Player.cpp.

7782{ m_areaSpiritHealerGuid = guid; }
Here is the caller graph for this function:

◆ setArenaFaction()

void Player::setArenaFaction ( uint8_t  faction)

Definition at line 866 of file Player.cpp.

866{ write(playerData()->player_bytes_3.s.arena_faction, faction); }
Here is the call graph for this function:

◆ setArenaTeam()

void Player::setArenaTeam ( uint8_t  type,
ArenaTeam arenaTeam 
)

Definition at line 8063 of file Player.cpp.

8064{
8065 m_arenaTeams[type] = arenaTeam;
8066
8067 if (arenaTeam)
8068 getSession()->SystemMessage("You are now a member of the arena team'%s'.", arenaTeam->m_name.c_str());
8069}
std::string m_name
Definition ArenaTeam.hpp:93
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAuraVision()

void Player::setAuraVision ( uint8_t  auraVision)

◆ setBankBagSlotItemGuid()

void Player::setBankBagSlotItemGuid ( uint8_t  slot,
uint64_t  guid 
)

Definition at line 955 of file Player.cpp.

955{ write(playerData()->bank_bag_slot[slot], guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBankSlotItemGuid()

void Player::setBankSlotItemGuid ( uint8_t  slot,
uint64_t  guid 
)

Definition at line 952 of file Player.cpp.

952{ write(playerData()->bank_slot[slot], guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBankSlots()

void Player::setBankSlots ( uint8_t  slots)

Definition at line 845 of file Player.cpp.

845{ write(playerData()->player_bytes_2.s.bank_slots, slots); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBanned()

void Player::setBanned ( uint32_t  timestamp = 4,
std::string  Reason = "" 
)

Definition at line 2340 of file Player.cpp.

2340{ m_banned = timestamp; m_banreason = Reason; }
Here is the caller graph for this function:

◆ setBattleground()

void Player::setBattleground ( Battleground bg)

Definition at line 8547 of file Player.cpp.

8547{ m_bg = bg; }
FMT_CONSTEXPR auto bg(detail::color_type background) noexcept -> text_style
Definition color.h:320
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBGEntryPoint()

void Player::setBGEntryPoint ( float  x,
float  y,
float  z,
float  o,
uint32_t  mapId,
int32_t  instanceId 
)

Definition at line 7822 of file Player.cpp.

7823{
7824 m_bgEntryData.location = { x, y, z, o };
7825 m_bgEntryData.mapId = mapId;
7826 m_bgEntryData.instanceId = instanceId;
7827}
Here is the caller graph for this function:

◆ setBgQueueType()

void Player::setBgQueueType ( uint32_t  type)

Definition at line 8574 of file Player.cpp.

8574{ this->m_bgQueueType = type; }
Here is the caller graph for this function:

◆ setBgTeam()

void Player::setBgTeam ( uint32_t  team)

Definition at line 2777 of file Player.cpp.

2777{ m_bgTeam = team; }
Here is the caller graph for this function:

◆ setBindPoint()

void Player::setBindPoint ( float  x,
float  y,
float  z,
float  o,
uint32_t  mapId,
uint32_t  zoneId 
)

Definition at line 7809 of file Player.cpp.

7810{
7811 m_bindData.location = { x, y, z, o };
7812 m_bindData.mapId = mapId;
7813 m_bindData.zoneId = zoneId;
7814}
Here is the caller graph for this function:

◆ setBlockPercentage()

void Player::setBlockPercentage ( float  value)

Definition at line 1082 of file Player.cpp.

1082{ write(playerData()->block_pct, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBuybackPriceSlot()

void Player::setBuybackPriceSlot ( uint8_t  slot,
uint32_t  price 
)

Definition at line 1243 of file Player.cpp.

1243{ write(playerData()->field_buy_back_price[slot], price); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBuybackTimestampSlot()

void Player::setBuybackTimestampSlot ( uint8_t  slot,
uint32_t  timestamp 
)

Definition at line 1246 of file Player.cpp.

1246{ write(playerData()->field_buy_back_timestamp[slot], timestamp); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChampioningFaction()

void Player::setChampioningFaction ( uint32_t  factionId)

Definition at line 11823 of file Player.cpp.

11823{ m_championingFactionId = factionId; }
Here is the caller graph for this function:

◆ setCoinage()

void Player::setCoinage ( uint64_t  coinage)

Definition at line 1185 of file Player.cpp.

1185{ write(playerData()->field_coinage, coinage); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCombatRating()

void Player::setCombatRating ( uint8_t  combatRating,
uint32_t  value 
)

Definition at line 1277 of file Player.cpp.

1277{ write(playerData()->field_combat_rating[combatRating], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCorpseData()

void Player::setCorpseData ( LocationVector  position,
int32_t  instanceId 
)

Definition at line 7419 of file Player.cpp.

7420{
7421 m_corpseData.location = position;
7422 m_corpseData.instanceId = instanceId;
7423}
Here is the caller graph for this function:

◆ setCreateBits()

void Player::setCreateBits ( UpdateMask updateMask,
Player target 
) const
protectedvirtual

Reimplemented from Object.

Definition at line 3556 of file Player.cpp.

3557{
3558 if (target == this)
3559 {
3560 Object::setCreateBits(updateMask, target);
3561 }
3562 else
3563 {
3564 for (uint32_t index = 0; index < m_valuesCount; index++)
3565 {
3566 if (m_uint32Values[index] != 0 && Player::m_visibleUpdateMask.GetBit(index))
3567 updateMask->SetBit(index);
3568 }
3569 }
3570}
virtual void setCreateBits(UpdateMask *updateMask, Player *target) const
Definition Object.cpp:3442
Here is the call graph for this function:

◆ setCurrencyTokenSlotItemGuid()

void Player::setCurrencyTokenSlotItemGuid ( uint8_t  slot,
uint64_t  guid 
)

Definition at line 972 of file Player.cpp.

972{ write(playerData()->currencytoken_slot[slot], guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDodgePercentage()

void Player::setDodgePercentage ( float  value)

Definition at line 1085 of file Player.cpp.

1085{ write(playerData()->dodge_pct, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDrunkValue()

void Player::setDrunkValue ( uint8_t  value)

Definition at line 859 of file Player.cpp.

859{ write(playerData()->player_bytes_3.s.drunk_value, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDualWield2H()

void Player::setDualWield2H ( bool  enable)

Definition at line 4266 of file Player.cpp.

4267{
4268 m_canDualWield2H = enable;
4269}
Here is the caller graph for this function:

◆ setDuelArbiter()

void Player::setDuelArbiter ( uint64_t  guid)

Definition at line 766 of file Player.cpp.

766{ write(playerData()->duel_arbiter, guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDuelState()

void Player::setDuelState ( uint8_t  state)

Definition at line 12128 of file Player.cpp.

12128{ m_duelState = state; }
state
Definition core.h:2305
Here is the caller graph for this function:

◆ setDuelStatus()

void Player::setDuelStatus ( uint8_t  status)

Definition at line 12125 of file Player.cpp.

12125{ m_duelStatus = status; }

◆ setDuelTeam()

void Player::setDuelTeam ( uint32_t  team)

Definition at line 871 of file Player.cpp.

871{ write(playerData()->duel_team, team); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDungeonDifficulty()

void Player::setDungeonDifficulty ( uint8_t  diff)

Definition at line 7236 of file Player.cpp.

7237{
7238 m_dungeonDifficulty = diff;
7239}
Here is the caller graph for this function:

◆ setEnabledActionBars()

void Player::setEnabledActionBars ( uint8_t  actionBarId)

Definition at line 1235 of file Player.cpp.

1235{ write(playerData()->player_field_bytes.s.enabled_action_bars, actionBarId); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEnteringToWorld()

void Player::setEnteringToWorld ( )

Definition at line 3552 of file Player.cpp.

3552{ m_enteringWorld = true; }
Here is the caller graph for this function:

◆ setExpertise()

void Player::setExpertise ( uint32_t  value)

Definition at line 1092 of file Player.cpp.

1092{ write(playerData()->expertise, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setExploredZone()

void Player::setExploredZone ( uint32_t  idx,
uint32_t  data 
)

Definition at line 1129 of file Player.cpp.

1130{
1132 write(playerData()->explored_zones[idx], data);
1133}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFace()

void Player::setFace ( uint8_t  face)

Definition at line 828 of file Player.cpp.

828{ write(playerData()->player_bytes.s.face, face); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFacialFeatures()

void Player::setFacialFeatures ( uint8_t  feature)

Definition at line 842 of file Player.cpp.

842{ write(playerData()->player_bytes_2.s.facial_hair, feature); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFactionAtWar()

void Player::setFactionAtWar ( uint32_t  faction,
bool  set 
)

Definition at line 11558 of file Player.cpp.

11559{
11560 if (faction >= 128)
11561 return;
11562
11563 FactionReputation* factionReputation = m_reputationByListId[faction];
11564 if (!factionReputation)
11565 return;
11566
11567 if (getReputationRankFromStanding(factionReputation->standing) <= STANDING_HOSTILE && !set)
11568 return;
11569
11570 if (!CanToggleAtWar(factionReputation->flag))
11571 return;
11572
11573 if (SetFlagAtWar(factionReputation->flag, set))
11575}
bool CanToggleAtWar(uint8_t flag)
Definition Player.cpp:11314
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFactionInactive()

void Player::setFactionInactive ( uint32_t  faction,
bool  set 
)

Definition at line 11702 of file Player.cpp.

11703{
11704 FactionReputation* factionReputation = m_reputationByListId[faction];
11705 if (!factionReputation)
11706 return;
11707}
Here is the caller graph for this function:

◆ setFactionStanding()

void Player::setFactionStanding ( uint32_t  faction,
int32_t  value 
)

Definition at line 11369 of file Player.cpp.

11370{
11371 WDB::Structures::FactionEntry const* factionEntry = sFactionStore.lookupEntry(faction);
11372 if (!factionEntry || factionEntry->RepListId < 0)
11373 return;
11374
11375 const int32_t minReputation = -42000; // 0/36000 Hated
11376 const int32_t exaltedReputation = 42000; // 0/1000 Exalted
11377 const int32_t maxReputation = 42999; // 999/1000 Exalted
11378
11379 int32_t newValue = value;
11380 if (newValue < minReputation)
11381 newValue = minReputation;
11382 else if (newValue > maxReputation)
11383 newValue = maxReputation;
11384
11385 auto reputation = m_reputation.find(faction);
11386 if (reputation == m_reputation.end())
11387 {
11388 if (!addNewFaction(factionEntry, newValue, false))
11389 return;
11390
11391 reputation = m_reputation.find(faction);
11392
11393#if VERSION_STRING > TBC
11394 if (reputation->second->standing >= 42000)
11395 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, 1, 0, 0);
11396
11397 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID, reputation->second->standing, 0);
11398#endif
11399
11401 onModStanding(factionEntry, reputation->second.get());
11402 }
11403 else
11404 {
11405 if (RankChangedFlat(reputation->second->standing, newValue))
11406 {
11407
11408#if VERSION_STRING > TBC
11409 if (reputation->second->standing - newValue >= exaltedReputation)
11410 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, -1, 0, 0);
11411 else if (newValue >= exaltedReputation)
11412 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, 1, 0, 0);
11413#endif
11414
11415 reputation->second->standing = newValue;
11417
11418#if VERSION_STRING > TBC
11419 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID, value, 0);
11420#endif
11421
11422 }
11423 else
11424 {
11425 reputation->second->standing = newValue;
11426 }
11427
11428 onModStanding(factionEntry, reputation->second.get());
11429 }
11430}
bool RankChangedFlat(int32_t Standing, int32_t NewStanding)
Definition Player.cpp:11364
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFallDisabledUntil()

void Player::setFallDisabledUntil ( time_t  time)

Definition at line 2048 of file Player.cpp.

2048{ m_fallDisabledUntil = time; }

◆ setFarsightGuid()

void Player::setFarsightGuid ( uint64_t  farsightGuid)

Definition at line 976 of file Player.cpp.

976{ write(playerData()->farsight_guid, farsightGuid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFfaPvpFlag()

void Player::setFfaPvpFlag ( )
overridevirtual

Reimplemented from Unit.

Definition at line 9828 of file Player.cpp.

9829{
9830 stopPvPTimer();
9831#if VERSION_STRING > TBC
9832 addPvpFlags(PVP_STATE_FLAG_FFA_PVP);
9833#else
9834 addPlayerFlags(PLAYER_FLAG_FREE_FOR_ALL_PVP);
9835#endif
9836
9838}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFreePrimaryProfessionPoints()

void Player::setFreePrimaryProfessionPoints ( uint32_t  points)

Definition at line 1052 of file Player.cpp.

1053{
1054 if (points > worldConfig.player.maxProfessions)
1055 points = worldConfig.player.maxProfessions;
1056
1057#if VERSION_STRING < Cata
1058 write(playerData()->character_points_2, points);
1059#else
1060 write(playerData()->character_points_1, points);
1061#endif
1062}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFullHealthMana()

void Player::setFullHealthMana ( )

Definition at line 7784 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGlyph()

void Player::setGlyph ( uint16_t  slot,
uint32_t  glyph 
)

Definition at line 1310 of file Player.cpp.

1310{ write(playerData()->field_glyphs[slot], glyph); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGlyphsEnabled()

void Player::setGlyphsEnabled ( uint32_t  glyphs)

Definition at line 1313 of file Player.cpp.

1313{ write(playerData()->glyphs_enabled, glyphs); }
Here is the call graph for this function:

◆ setGlyphSlot()

void Player::setGlyphSlot ( uint16_t  slot,
uint32_t  glyph 
)

Definition at line 1307 of file Player.cpp.

1307{ write(playerData()->field_glyph_slots[slot], glyph); }
Here is the call graph for this function:

◆ setGroupInviterId()

void Player::setGroupInviterId ( uint32_t  inviterId)

Definition at line 7881 of file Player.cpp.

7881{ m_grouIdpInviterId = inviterId; }
Here is the caller graph for this function:

◆ setGroupUpdateFlags()

void Player::setGroupUpdateFlags ( uint32_t  flags)

Definition at line 7902 of file Player.cpp.

7903{
7904 if (getGroup())
7905 m_groupUpdateFlags = flags;
7906}
Here is the call graph for this function:

◆ setGuildAndGroupInfo()

void Player::setGuildAndGroupInfo ( )

Definition at line 9517 of file Player.cpp.

9518{
9519 if (getPlayerInfo()->m_guild)
9520 {
9521 if (const auto guild = sGuildMgr.getGuildById(getPlayerInfo()->m_guild))
9522 {
9523 setGuildId(getPlayerInfo()->m_guild);
9524 setGuildRank(getPlayerInfo()->guildRank);
9525 guild->sendLoginInfo(getSession());
9526#if VERSION_STRING >= Cata
9527 setGuildLevel(guild->getLevel());
9528#endif
9529 }
9530 }
9531
9532 if (getPlayerInfo()->m_Group)
9534}
void Update()
Definition Group.cpp:199
CachedCharacterInfo * getPlayerInfo() const
Definition Player.cpp:2885
void setGuildLevel(uint32_t guildLevel)
Definition Player.cpp:817
void setGuildId(uint32_t guildId)
Definition Player.cpp:796
void setGuildRank(uint32_t guildRank)
Definition Player.cpp:813
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGuildId()

void Player::setGuildId ( uint32_t  guildId)

Definition at line 796 of file Player.cpp.

797{
798#if VERSION_STRING < Cata
799 write(playerData()->guild_id, guildId);
800#else
801 write(objectData()->data, WoWGuid(guildId, 0, HIGHGUID_TYPE_GUILD).getRawGuid());
802
803 if (guildId)
804 addPlayerFlags(PLAYER_FLAG_GUILD_LVL_ENABLED);
805 else
806 removePlayerFlags(PLAYER_FLAG_GUILD_LVL_ENABLED);
807
808 write(objectData()->field_type.parts.guild_id, static_cast<uint16_t>(guildId != 0 ? 1 : 0));
809#endif
810}
@ HIGHGUID_TYPE_GUILD
Definition WoWGuid.h:52
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGuildLevel()

void Player::setGuildLevel ( uint32_t  guildLevel)

Definition at line 817 of file Player.cpp.

817{ write(playerData()->guild_level, guildLevel); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGuildRank()

void Player::setGuildRank ( uint32_t  guildRank)

Definition at line 813 of file Player.cpp.

813{ write(playerData()->guild_rank, guildRank); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGuildTimestamp()

void Player::setGuildTimestamp ( uint32_t  timestamp)

Definition at line 874 of file Player.cpp.

874{ write(playerData()->guild_timestamp, timestamp); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHairColor()

void Player::setHairColor ( uint8_t  color)

Definition at line 834 of file Player.cpp.

834{ write(playerData()->player_bytes.s.hair_color, color); }
color
Definition color.h:16
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHairStyle()

void Player::setHairStyle ( uint8_t  style)

Definition at line 831 of file Player.cpp.

831{ write(playerData()->player_bytes.s.hair_style, style); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHasBgFlag()

void Player::setHasBgFlag ( bool  set)

Definition at line 8578 of file Player.cpp.

8578{ m_bgHasFlag = set; }
Here is the caller graph for this function:

◆ setHasWonRbgToday()

void Player::setHasWonRbgToday ( bool  value)

Definition at line 8572 of file Player.cpp.

8572{ this->m_hasWonRbgToday = value; }

◆ setHealthFromSpell()

void Player::setHealthFromSpell ( uint32_t  value)
inline

Definition at line 879 of file Player.hpp.

Here is the caller graph for this function:

◆ setHitFromSpell()

void Player::setHitFromSpell ( float  value)
inline

Definition at line 2038 of file Player.hpp.

2038{ m_hitFromSpell = value; }
Here is the caller graph for this function:

◆ setInitialDisplayIds()

void Player::setInitialDisplayIds ( uint8_t  gender,
uint8_t  race 
)

Definition at line 2645 of file Player.cpp.

2646{
2647 if (const auto raceEntry = sChrRacesStore.lookupEntry(race))
2648 {
2649 switch (gender)
2650 {
2651 case GENDER_MALE:
2652 setDisplayId(raceEntry->model_male);
2653 setNativeDisplayId(raceEntry->model_male);
2654 break;
2655 case GENDER_FEMALE:
2656 setDisplayId(raceEntry->model_female);
2657 setNativeDisplayId(raceEntry->model_female);
2658 break;
2659 default:
2660 sLogger.failure("Gender {} is not valid for Player charecters!", gender);
2661 }
2662 }
2663 else
2664 {
2665 sLogger.failure("Race {} is not supported by this AEVersion ({})", race, getAEVersion());
2666 }
2667}
@ GENDER_MALE
@ GENDER_FEMALE
uint32_t getAEVersion()
void setDisplayId(uint32_t id)
Definition Unit.cpp:1253
void setNativeDisplayId(uint32_t id)
Definition Unit.cpp:1276
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInitialPlayerData()

void Player::setInitialPlayerData ( )

Definition at line 3616 of file Player.cpp.

3617{
3618 if (m_levelInfo != nullptr)
3619 {
3622 }
3623 else
3624 {
3625 sLogger.failure("Major error in Player::setInitialPlayerData : No LevelInfo for player (level {}, race {}, class {})!", getLevel(), getRace(), getClass());
3626
3627 setBaseHealth(1);
3628 setBaseMana(1);
3629 }
3630
3631 // Set max health and powers
3633
3634 // First initialize all power fields to 0
3635 for (uint8_t power = POWER_TYPE_MANA; power < TOTAL_PLAYER_POWER_TYPES; ++power)
3636 setMaxPower(static_cast<PowerType>(power), 0);
3637
3638 // Next set correct power for each class
3639 switch (getClass())
3640 {
3641 case WARRIOR:
3642 {
3644 } break;
3645#if VERSION_STRING >= Cata
3646 case HUNTER:
3647 {
3649 } break;
3650#endif
3651 case ROGUE:
3652 {
3654 } break;
3655#if VERSION_STRING >= WotLK
3656 case DEATHKNIGHT:
3657 {
3660 } break;
3661#endif
3662 default:
3663 {
3664#if VERSION_STRING >= Cata
3665 // Another switch case to set secondary powers
3666 switch (getClass())
3667 {
3668 case PALADIN:
3670 break;
3671 case WARLOCK:
3673 break;
3674 case DRUID:
3676 break;
3677 default:
3678 break;
3679 }
3680#endif
3682 } break;
3683 }
3684
3685 setMinDamage(0.0f);
3686 setMaxDamage(0.0f);
3687 setMinOffhandDamage(0.0f);
3688 setMaxOffhandDamage(0.0f);
3689 setMinRangedDamage(0.0f);
3690 setMaxRangedDamage(0.0f);
3691
3692 setBaseAttackTime(MELEE, 2000);
3695
3696 setAttackPower(0);
3702
3703 setBlockPercentage(0.0f);
3704 setDodgePercentage(0.0f);
3705 setParryPercentage(0.0f);
3708#if VERSION_STRING >= TBC
3709 setExpertise(0);
3712 setShieldBlock(0);
3713#endif
3714#if VERSION_STRING >= WotLK
3716#endif
3717
3718#if VERSION_STRING >= TBC
3720
3723#endif
3724
3725 setModCastSpeed(1.0f);
3726
3727 for (uint8_t i = 0; i < TOTAL_SPELL_SCHOOLS; ++i)
3728 {
3731 setModDamageDonePct(1.0f, i);
3732
3733#if VERSION_STRING >= TBC
3734 setSpellCritPercentage(i, 0.0f);
3735#endif
3736 setResistance(i, 0);
3737
3739 setPowerCostMultiplier(i, 0.0f);
3740 }
3741
3742#if VERSION_STRING >= WotLK
3743 for (uint8_t i = 0; i < WOWPLAYER_NO_REAGENT_COST_COUNT; ++i)
3744 {
3745 setNoReagentCost(i, 0);
3746 }
3747#endif
3748
3749 for (uint8_t i = 0; i < MAX_PCR; ++i)
3750 setCombatRating(i, 0);
3751
3752 for (uint8_t i = 0; i < STAT_COUNT; ++i)
3753 {
3754 m_baseStats[i] = m_levelInfo->Stat[i];
3755 calcStat(i);
3756 }
3757
3758 updateStats();
3759
3760 setMaxLevel(worldConfig.player.playerLevelCap);
3761
3763#if VERSION_STRING == TBC
3765#elif VERSION_STRING >= WotLK
3766 addUnitFlags2(UNIT_FLAG2_ENABLE_POWER_REGEN);
3767#endif
3768
3769 // Set current health and power after stats are loaded
3775#if VERSION_STRING >= WotLK
3778#endif
3779}
@ MAX_PCR
PowerType
Definition PowerType.hpp:11
@ POWER_TYPE_SOUL_SHARDS
Definition PowerType.hpp:27
@ TOTAL_PLAYER_POWER_TYPES
Definition PowerType.hpp:38
@ POWER_TYPE_ECLIPSE
Definition PowerType.hpp:28
@ UNIT_FLAG2_ENABLE_POWER_REGEN
@ POS_AURA_LIMIT_PVP_ATTACKABLE
@ RANGED
void setSpellCritPercentage(uint8_t school, float value)
Definition Player.cpp:1111
void setModDamageDonePct(float damagePct, uint8_t shool)
Definition Player.cpp:1210
void setMeleeCritPercentage(float value)
Definition Player.cpp:1101
void setNoReagentCost(uint8_t index, uint32_t value)
Definition Player.cpp:1304
void setDodgePercentage(float value)
Definition Player.cpp:1085
void setBlockPercentage(float value)
Definition Player.cpp:1082
void setShieldBlock(uint32_t value)
Definition Player.cpp:1114
void setOffHandCritPercentage(float value)
Definition Player.cpp:1108
void setRangedCritPercentage(float value)
Definition Player.cpp:1104
void setMaxLevel(uint32_t level)
Definition Player.cpp:1158
void setParryPercentage(float value)
Definition Player.cpp:1088
void setShieldBlockCritPercentage(float value)
Definition Player.cpp:1119
void setPositiveAuraLimit(uint8_t limit)
Definition Unit.cpp:1553
void setPowerCostModifier(uint16_t school, uint32_t modifier)
Definition Unit.cpp:1603
uint32_t getBaseHealth() const
Definition Unit.cpp:1473
void setPowerCostMultiplier(uint16_t school, float multiplier)
Definition Unit.cpp:1616
uint32_t getBaseMana() const
Definition Unit.cpp:1470
void setAttackPowerMods(int32_t modifier)
Definition Unit.cpp:1633
void setRangedAttackPowerMods(int32_t modifier)
Definition Unit.cpp:1672
void setRangedAttackPower(int32_t power)
Definition Unit.cpp:1594
void setBaseAttackTime(uint8_t slot, uint32_t time)
Definition Unit.cpp:1234
void setModCastSpeed(float modifier)
Definition Unit.cpp:1422
void setAttackPower(uint32_t value)
Definition Unit.cpp:1591
Here is the caller graph for this function:

◆ setInitialPlayerProfessions()

void Player::setInitialPlayerProfessions ( )

Definition at line 5201 of file Player.cpp.

5202{
5203 // Since cata player must have profession skills initialized even if the player does not have them
5204#if VERSION_STRING == Cata
5205 for (uint16_t skillId = SKILL_FROST; skillId != SKILL_PET_HYDRA; ++skillId)
5206#elif VERSION_STRING == Mop
5207 for (uint16_t skillId = SKILL_SWORDS; skillId != SKILL_DIREHORN; ++skillId)
5208#endif
5209 {
5210 const auto skillLine = sSkillLineStore.lookupEntry(skillId);
5211 if (skillLine == nullptr)
5212 continue;
5213
5214 if (skillLine->type != SKILL_TYPE_PROFESSION && skillLine->type != SKILL_TYPE_SECONDARY)
5215 continue;
5216
5217 if (!hasSkillLine(skillId, true))
5218 addSkillLine(skillId, 0, 0, false, true);
5219 }
5220}
@ SKILL_PET_HYDRA
Definition Skill.hpp:234
@ SKILL_DIREHORN
Definition Skill.hpp:272
@ SKILL_SWORDS
Definition Skill.hpp:24
@ SKILL_FROST
Definition Skill.hpp:15
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInitialTalentPoints()

void Player::setInitialTalentPoints ( bool  talentsResetted = false)

Definition at line 6056 of file Player.cpp.

6057{
6058 if (getLevel() < 10)
6059 {
6060 setTalentPoints(0);
6061 return;
6062 }
6063
6064 // Calculate initial talent points based on level
6065 uint32_t talentPoints = 0;
6066#if VERSION_STRING >= Cata
6067 auto talentPointsAtLevel = sNumTalentsAtLevel.lookupEntry(getLevel());
6068 if (talentPointsAtLevel != nullptr)
6069 talentPoints = static_cast<uint32_t>(talentPointsAtLevel->talentPoints);
6070#else
6071 talentPoints = getLevel() - 9;
6072#endif
6073
6074#ifdef FT_DEATH_KNIGHT
6075 if (getClass() == DEATHKNIGHT)
6076 {
6077 if (GetMapId() == 609)
6078 {
6079 // If Death Knight is in the instanced Ebon Hold (map 609), talent points are calculated differently,
6080 // because Death Knights receive their talent points from their starting quest chain.
6081 // However if Death Knight is not in the instanced Ebon Hold, it is safe to assume that
6082 // the player has completed the DK starting quest chain and normal calculation can be used.
6083 uint32_t dkTalentPoints = 0;
6084#if VERSION_STRING >= Cata
6085 auto dkBaseTalentPoints = sNumTalentsAtLevel.lookupEntry(55);
6086 if (dkBaseTalentPoints != nullptr)
6087 dkTalentPoints = getLevel() < 55 ? 0 : talentPoints - static_cast<uint32_t>(dkBaseTalentPoints->talentPoints);
6088#else
6089 dkTalentPoints = getLevel() < 55 ? 0 : getLevel() - 55;
6090#endif
6091 // Add talent points from quests
6092 dkTalentPoints += m_talentPointsFromQuests;
6093
6094 if (dkTalentPoints < talentPoints)
6095 talentPoints = dkTalentPoints;
6096 }
6097
6098 // Add extra talent points if any is set in config files
6099 talentPoints += worldConfig.player.deathKnightStartTalentPoints;
6100 }
6101#endif
6102
6103 // If player's level is increased, player's already spent talent points must be subtracted from initial talent points
6104 uint32_t usedTalentPoints = 0;
6105 if (!talentsResetted)
6106 {
6107#ifdef FT_DUAL_SPEC
6108 if (m_talentSpecsCount == 2)
6109 {
6111 if (m_specs[inactiveSpec].getTalents().size() > 0)
6112 {
6113 uint32_t usedTalentPoints2 = 0;
6114 for (const auto& [talentId, rank] : m_specs[inactiveSpec].getTalents())
6115 {
6116 usedTalentPoints2 += rank + 1;
6117 }
6118
6119 if (usedTalentPoints2 > talentPoints)
6120 usedTalentPoints2 = talentPoints;
6121
6122 m_specs[inactiveSpec].setTalentPoints(talentPoints - usedTalentPoints2);
6123 }
6124 }
6125#endif
6126 if (getActiveSpec().getTalents().size() > 0)
6127 {
6128 for (const auto& [talentId, rank] : getActiveSpec().getTalents())
6129 {
6130 usedTalentPoints += rank + 1;
6131 }
6132
6133 if (usedTalentPoints > talentPoints)
6134 usedTalentPoints = talentPoints;
6135 }
6136 }
6137
6138 setTalentPoints(talentPoints - usedTalentPoints, false);
6139 smsg_TalentsInfo(false);
6140}
SERVER_DECL WDB::WDBContainer< WDB::Structures::NumTalentsAtLevel > sNumTalentsAtLevel
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInventorySlotItemGuid()

void Player::setInventorySlotItemGuid ( uint8_t  slot,
uint64_t  guid 
)

Definition at line 946 of file Player.cpp.

946{ write(playerData()->inventory_slot[slot], guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInviteArenaTeamId()

void Player::setInviteArenaTeamId ( uint32_t  id)

Definition at line 8128 of file Player.cpp.

8128{ m_inviteArenaTeamId = id; }

◆ setInvitedByGuildId()

void Player::setInvitedByGuildId ( uint32_t  GuildId)

Definition at line 7863 of file Player.cpp.

7863{ m_invitedByGuildId = GuildId; }
Here is the caller graph for this function:

◆ setIsQueuedForBg()

void Player::setIsQueuedForBg ( bool  set)

Definition at line 8553 of file Player.cpp.

8553{ m_isQueuedForBg = set; }
Here is the caller graph for this function:

◆ setIsQueuedForRbg()

void Player::setIsQueuedForRbg ( bool  value)

Definition at line 8560 of file Player.cpp.

8560{ this->m_isQueuedForRbg = value; }
Here is the caller graph for this function:

◆ setKnownCurrencies()

void Player::setKnownCurrencies ( uint64_t  currencies)

Definition at line 990 of file Player.cpp.

990{ write(playerData()->field_known_currencies, currencies); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setKnownPvPTitle()

void Player::setKnownPvPTitle ( RankTitles  title,
bool  set 
)

Definition at line 8526 of file Player.cpp.

8527{
8528#if VERSION_STRING > Classic
8529 if (!set && !hasPvPTitle(title))
8530 return;
8531
8532 const auto index = static_cast<uint8_t>(title / 32);
8533 const uint64_t current = getKnownTitles(index);
8534
8535 if (set)
8536 setKnownTitles(index, current | 1ULL << static_cast<uint64_t>((title % 32)));
8537 else
8538 setKnownTitles(index, current & ~1 << (title % 32));
8539
8540 m_session->SendPacket(SmsgTitleEarned(title, set ? 1 : 0).serialise().get());
8541#endif
8542}
bool hasPvPTitle(RankTitles title)
Definition Player.cpp:8515
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLastBattlegroundPetId()

void Player::setLastBattlegroundPetId ( uint8_t  petId)

Definition at line 12657 of file Player.cpp.

12657{ m_battlegroundLastPetId = petId; }
Here is the caller graph for this function:

◆ setLastBattlegroundPetSpell()

void Player::setLastBattlegroundPetSpell ( uint32_t  petSpell)

Definition at line 12659 of file Player.cpp.

12659{ m_battlegroundLastPetSpell = petSpell; }
Here is the caller graph for this function:

◆ setLastPotion()

void Player::setLastPotion ( uint32_t  itemId)
inline

Definition at line 904 of file Player.hpp.

904{ m_lastPotionId = itemId; }
uint32_t m_lastPotionId
Definition Player.hpp:916
Here is the caller graph for this function:

◆ setLifetimeHonorableKills()

void Player::setLifetimeHonorableKills ( uint32_t  kills)

Definition at line 1264 of file Player.cpp.

1264{ write(playerData()->field_lifetime_honorable_kills, kills); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLoginFlag()

void Player::setLoginFlag ( uint32_t  flag)

Definition at line 2643 of file Player.cpp.

2643{ m_loginFlag = flag; }
Here is the caller graph for this function:

◆ setLoginPosition()

void Player::setLoginPosition ( )

Definition at line 9461 of file Player.cpp.

9462{
9463 bool startOnGMIsland = false;
9464 if (m_session->HasGMPermissions() && m_firstLogin && sWorld.settings.gm.isStartOnGmIslandEnabled)
9465 startOnGMIsland = true;
9466
9467 uint32_t mapId = 1;
9468 float orientation = 0;
9469 float position_x = 16222.6f;
9470 float position_y = 16265.9f;
9471 float position_z = 14.2085f;
9472
9473 if (startOnGMIsland)
9474 {
9475 m_position.ChangeCoords({ position_x, position_y, position_z, orientation });
9476 m_mapId = mapId;
9477
9479 }
9480 else
9481 {
9482 mapId = GetMapId();
9483 orientation = GetOrientation();
9484 position_x = GetPositionX();
9485 position_y = GetPositionY();
9486 position_z = GetPositionZ();
9487 }
9488
9489 sendLoginVerifyWorldPacket(mapId, position_x, position_y, position_z, orientation);
9490}
void sendLoginVerifyWorldPacket(uint32_t mapId, float posX, float posY, float posZ, float orientation)
Definition Player.cpp:9699
bool HasGMPermissions() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLootableOnCorpse()

void Player::setLootableOnCorpse ( bool  lootable)

Definition at line 11310 of file Player.cpp.

11310{ m_lootableOnCorpse = lootable; }
Here is the caller graph for this function:

◆ setLootGuid()

void Player::setLootGuid ( const uint64_t guid)

Definition at line 10788 of file Player.cpp.

10788{ m_lootGuid = guid; }
Here is the caller graph for this function:

◆ setManaFromSpell()

void Player::setManaFromSpell ( uint32_t  value)
inline

Definition at line 882 of file Player.hpp.

Here is the caller graph for this function:

◆ setManaRegeneration()

void Player::setManaRegeneration ( float  value)

Definition at line 1143 of file Player.cpp.

1143{ write(playerData()->field_mod_mana_regen, value); }
Here is the call graph for this function:

◆ setManaRegenerationWhileCasting()

void Player::setManaRegenerationWhileCasting ( float  value)

Definition at line 1146 of file Player.cpp.

1146{ write(playerData()->field_mod_mana_regen_interrupt, value); }
Here is the call graph for this function:

◆ setMapEntryPoint()

void Player::setMapEntryPoint ( uint32_t  mapId)

Definition at line 2050 of file Player.cpp.

2051{
2052 if (IS_INSTANCE(GetMapId()))
2053 return;
2054
2055 if (MySQLStructure::MapInfo const* mapInfo = sMySQLStore.getWorldMapInfo(mapId))
2056 setBGEntryPoint(mapInfo->repopx, mapInfo->repopy, mapInfo->repopz, GetOrientation(), mapInfo->repopmapid, GetInstanceID());
2057 else
2058 setBGEntryPoint(0, 0, 0, 0, 0, 0);
2059}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxLevel()

void Player::setMaxLevel ( uint32_t  level)

Definition at line 1158 of file Player.cpp.

1159{
1160#if VERSION_STRING > Classic
1161 write(playerData()->field_max_level, level);
1162#else
1163 m_classicMaxLevel = level;
1164#endif
1165}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMeleeCritPercentage()

void Player::setMeleeCritPercentage ( float  value)

Definition at line 1101 of file Player.cpp.

1101{ write(playerData()->crit_pct, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMisdirectionTarget()

void Player::setMisdirectionTarget ( uint64_t  PlayerGUID)
inline

Definition at line 2089 of file Player.hpp.

2089{ m_misdirectionTarget = PlayerGUID; }
Here is the caller graph for this function:

◆ setModDamageDoneNegative()

void Player::setModDamageDoneNegative ( uint16_t  school,
uint32_t  value 
)

Definition at line 1206 of file Player.cpp.

1206{ write(playerData()->field_mod_damage_done_negative[school], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModDamageDonePct()

void Player::setModDamageDonePct ( float  damagePct,
uint8_t  shool 
)

Definition at line 1210 of file Player.cpp.

1210{ write(playerData()->field_mod_damage_done_pct[shool], damagePct); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModDamageDonePositive()

void Player::setModDamageDonePositive ( uint16_t  school,
uint32_t  value 
)

Definition at line 1202 of file Player.cpp.

1202{ write(playerData()->field_mod_damage_done_positive[school], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModHealingDone()

void Player::setModHealingDone ( uint32_t  value)

Definition at line 1214 of file Player.cpp.

1214{ write(playerData()->field_mod_healing_done, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModTargetPhysicalResistance()

void Player::setModTargetPhysicalResistance ( uint32_t  value)

Definition at line 1222 of file Player.cpp.

1222{ write(playerData()->field_mod_target_physical_resistance, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModTargetResistance()

void Player::setModTargetResistance ( uint32_t  value)

Definition at line 1218 of file Player.cpp.

1218{ write(playerData()->field_mod_target_resistance, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMountSpellId()

void Player::setMountSpellId ( uint32_t  id)

Definition at line 1513 of file Player.cpp.

1513{ m_mountSpellId = id; }
Here is the caller graph for this function:

◆ setMountVehicleId()

void Player::setMountVehicleId ( uint32_t  id)

Definition at line 1517 of file Player.cpp.

1517{ m_mountVehicleId = id; }
Here is the caller graph for this function:

◆ setMover()

void Player::setMover ( Unit target)

Definition at line 10283 of file Player.cpp.

10284{
10286 m_controledUnit = target;
10287
10288#if VERSION_STRING > WotLK
10289 ObjectGuid guid = target->getGuid();
10290
10292 data.writeBit(guid[5]);
10293 data.writeBit(guid[7]);
10294 data.writeBit(guid[3]);
10295 data.writeBit(guid[6]);
10296 data.writeBit(guid[0]);
10297 data.writeBit(guid[4]);
10298 data.writeBit(guid[1]);
10299 data.writeBit(guid[2]);
10300
10301 data.WriteByteSeq(guid[6]);
10302 data.WriteByteSeq(guid[2]);
10303 data.WriteByteSeq(guid[3]);
10304 data.WriteByteSeq(guid[0]);
10305 data.WriteByteSeq(guid[5]);
10306 data.WriteByteSeq(guid[7]);
10307 data.WriteByteSeq(guid[1]);
10308 data.WriteByteSeq(guid[4]);
10309
10310 sendPacket(&data);
10311#endif
10312}
Unit * m_controledUnit
Definition Unit.hpp:694
WoWGuid m_MoverWoWGuid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setName()

void Player::setName ( std::string  name)

Definition at line 2640 of file Player.cpp.

2640{ m_name = name; }
Here is the caller graph for this function:

◆ setNextLevelXp()

void Player::setNextLevelXp ( uint32_t  xp)

Definition at line 998 of file Player.cpp.

998{ write(playerData()->next_level_xp, xp); }
Here is the call graph for this function:

◆ setNoReagentCost()

void Player::setNoReagentCost ( uint8_t  index,
uint32_t  value 
)

Definition at line 1304 of file Player.cpp.

1304{ write(playerData()->no_reagent_cost[index], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOffHandCritPercentage()

void Player::setOffHandCritPercentage ( float  value)

Definition at line 1108 of file Player.cpp.

1108{ write(playerData()->offhand_crit_pct, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOffHandExpertise()

void Player::setOffHandExpertise ( uint32_t  value)

Definition at line 1096 of file Player.cpp.

1096{ write(playerData()->offhand_expertise, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPackSlotItemGuid()

void Player::setPackSlotItemGuid ( uint8_t  slot,
uint64_t  guid 
)

Definition at line 949 of file Player.cpp.

949{ write(playerData()->pack_slot[slot], guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setParryPercentage()

void Player::setParryPercentage ( float  value)

Definition at line 1088 of file Player.cpp.

1088{ write(playerData()->parry_pct, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPctReputationMod()

void Player::setPctReputationMod ( int32_t  value)

Definition at line 11821 of file Player.cpp.

Here is the caller graph for this function:

◆ setPendingBattleground()

void Player::setPendingBattleground ( Battleground bg)

Definition at line 8550 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPendingBind()

void Player::setPendingBind ( uint32_t  instanceId,
uint32_t  bindTimer 
)

Definition at line 12921 of file Player.cpp.

12922{
12923 m_pendingBindId = instanceId;
12924 m_pendingBindTimer = bindTimer;
12925}
uint32_t m_pendingBindTimer
Definition Player.hpp:2157
Here is the caller graph for this function:

◆ setPhase()

void Player::setPhase ( uint8_t  command = PHASE_SET,
uint32_t  newPhase = 1 
)
overridevirtual

Reimplemented from Unit.

Definition at line 2063 of file Player.cpp.

2064{
2065 Unit::setPhase(command, newPhase);
2066
2067 if (getSession())
2068 {
2069#if VERSION_STRING == WotLK
2070 sendPacket(SmsgPhaseShiftChange(newPhase, getGuid()).serialise().get());
2071#elif VERSION_STRING > WotLK
2072
2073 uint32_t phaseFlags = 0;
2074
2075 for (uint32_t i = 0; i < sPhaseStore.getNumRows(); ++i)
2076 {
2077 if (WDB::Structures::PhaseEntry const* phase = sPhaseStore.lookupEntry(i))
2078 {
2079 if (phase->PhaseShift == newPhase)
2080 {
2081 phaseFlags = phase->Flags;
2082 break;
2083 }
2084 }
2085 }
2086
2087 sendPacket(SmsgPhaseShiftChange(newPhase, getGuid(), phaseFlags, GetMapId()).serialise().get());
2088#endif
2089 }
2090
2091 getSummonInterface()->setPhase(command, newPhase);
2092
2093 if (Unit* charm = m_WorldMap->getUnit(getCharmGuid()))
2094 charm->setPhase(command, newPhase);
2095}
SERVER_DECL WDB::WDBContainer< WDB::Structures::PhaseEntry > sPhaseStore
void setPhase(uint8_t command, uint32_t newPhase)
virtual void setPhase(uint8_t command=PHASE_SET, uint32_t newPhase=1)
Definition Unit.cpp:1715
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlayerBytes()

void Player::setPlayerBytes ( uint32_t  bytes)

Definition at line 822 of file Player.cpp.

822{ write(playerData()->player_bytes.raw, bytes); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlayerBytes2()

void Player::setPlayerBytes2 ( uint32_t  bytes2)

Definition at line 839 of file Player.cpp.

839{ write(playerData()->player_bytes_2.raw, bytes2); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlayerBytes3()

void Player::setPlayerBytes3 ( uint32_t  bytes3)

Definition at line 853 of file Player.cpp.

853{ write(playerData()->player_bytes_3.raw, bytes3); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlayerFieldBytes()

void Player::setPlayerFieldBytes ( uint32_t  bytes)

Definition at line 1227 of file Player.cpp.

1227{ write(playerData()->player_field_bytes.raw, bytes); }
Here is the call graph for this function:

◆ setPlayerFieldBytes2()

void Player::setPlayerFieldBytes2 ( uint32_t  bytes)

◆ setPlayerFieldBytesMiscFlag()

void Player::setPlayerFieldBytesMiscFlag ( uint8_t  miscFlag)

Definition at line 1230 of file Player.cpp.

1230{ write(playerData()->player_field_bytes.s.misc_flags, miscFlag); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlayerFlags()

void Player::setPlayerFlags ( uint32_t  flags)

Definition at line 769 of file Player.cpp.

770{
771 write(playerData()->player_flags, flags);
772
773#if VERSION_STRING == TBC
774 // TODO Fix this later
775 return;
776#endif
777
778 // Update player flags also to group
779 if (!IsInWorld() || getGroup() == nullptr)
780 return;
781
783}
@ GROUP_UPDATE_FLAG_STATUS
Definition Group.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlayerGender()

void Player::setPlayerGender ( uint8_t  gender)

Definition at line 856 of file Player.cpp.

856{ write(playerData()->player_bytes_3.s.gender, gender); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPlayerInfoIfNeeded()

void Player::setPlayerInfoIfNeeded ( )

Definition at line 9492 of file Player.cpp.

9493{
9494 m_playerInfo = sObjectMgr.getCachedCharacterInfo(getGuidLow());
9495 if (m_playerInfo == nullptr)
9496 {
9497 auto playerInfo = std::make_unique<CachedCharacterInfo>();
9498 playerInfo->cl = getClass();
9499 playerInfo->gender = getGender();
9500 playerInfo->guid = getGuidLow();
9501 std::string name = getName();
9503 playerInfo->name = name;
9504 playerInfo->lastLevel = getLevel();
9505 playerInfo->lastOnline = UNIXTIME;
9506 playerInfo->lastZone = getZoneId();
9507 playerInfo->race = getRace();
9508 playerInfo->team = getTeam();
9509 playerInfo->guildRank = GUILD_RANK_NONE;
9510 playerInfo->m_Group = nullptr;
9511 playerInfo->subGroup = 0;
9512
9513 m_playerInfo = sObjectMgr.addCachedCharacterInfo(std::move(playerInfo));
9514 }
9515}
#define GUILD_RANK_NONE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProfessionSkillLine()

void Player::setProfessionSkillLine ( uint32_t  index,
uint32_t  value 
)

Definition at line 1027 of file Player.cpp.

1027{ write(playerData()->profession_skill_line[index], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPvpFlag()

void Player::setPvpFlag ( )
overridevirtual

Reimplemented from Unit.

Definition at line 9790 of file Player.cpp.

9791{
9792 stopPvPTimer();
9793#if VERSION_STRING > TBC
9794 addPvpFlags(PVP_STATE_FLAG_PVP);
9795 addPlayerFlags(PLAYER_FLAG_PVP_TIMER);
9796#else
9798#endif
9799
9801
9804}
@ PLAYER_FLAG_PVP_GUARD_ATTACKABLE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPvpRank()

void Player::setPvpRank ( uint8_t  rank)

Definition at line 862 of file Player.cpp.

862{ write(playerData()->player_bytes_3.s.pvp_rank, rank); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuestLogEntryBySlot()

void Player::setQuestLogEntryBySlot ( uint8_t  slot,
uint32_t  questEntry 
)

Definition at line 878 of file Player.cpp.

878{ write(playerData()->quests[slot].quest_id, questEntry); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuestLogExpireTimeBySlot()

void Player::setQuestLogExpireTimeBySlot ( uint8_t  slot,
uint32_t  expireTime 
)

Definition at line 917 of file Player.cpp.

917{ write(playerData()->quests[slot].expire_time, expireTime); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuestLogRequiredMobOrGoBySlot()

void Player::setQuestLogRequiredMobOrGoBySlot ( uint8_t  slot,
uint32_t  mobOrGoCount 
)

Definition at line 902 of file Player.cpp.

902{ write(playerData()->quests[slot].required_mob_or_go, mobOrGoCount); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuestLogStateBySlot()

void Player::setQuestLogStateBySlot ( uint8_t  slot,
uint32_t  state 
)

Definition at line 890 of file Player.cpp.

891{
892 //\todo: write last 1*8 bits as state
893 write(playerData()->quests[slot].required_count_state, state);
894}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuestSharerDbId()

void Player::setQuestSharerDbId ( uint32_t  id)

Definition at line 8923 of file Player.cpp.

8923{ m_questSharer = id; }
Here is the caller graph for this function:

◆ setQueuedBgInstanceId()

void Player::setQueuedBgInstanceId ( uint32_t  id)

Definition at line 8557 of file Player.cpp.

8557{ m_queuedBgInstanceId = id; }
Here is the caller graph for this function:

◆ setRaidDifficulty()

void Player::setRaidDifficulty ( uint8_t  diff)

Definition at line 7246 of file Player.cpp.

7247{
7248 m_raidDifficulty = diff;
7249}
Here is the caller graph for this function:

◆ setRangedCritPercentage()

void Player::setRangedCritPercentage ( float  value)

Definition at line 1104 of file Player.cpp.

1104{ write(playerData()->ranged_crit_pct, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setResistanceBuffModNegative()

void Player::setResistanceBuffModNegative ( uint8_t  type,
uint32_t  value 
)

Definition at line 1198 of file Player.cpp.

1198{ write(playerData()->resistance_buff_mod_negative[type], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setResistanceBuffModPositive()

void Player::setResistanceBuffModPositive ( uint8_t  type,
uint32_t  value 
)

Definition at line 1195 of file Player.cpp.

1195{ write(playerData()->resistance_buff_mod_positive[type], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setResistMCrit()

void Player::setResistMCrit ( float  newvalue)
inline

Definition at line 886 of file Player.hpp.

886{ m_resistCritical[0] = newvalue; }

◆ setResistRCrit()

void Player::setResistRCrit ( float  newvalue)
inline

Definition at line 889 of file Player.hpp.

889{ m_resistCritical[1] = newvalue; }

◆ setRestState()

void Player::setRestState ( uint8_t  state)

Definition at line 848 of file Player.cpp.

848{ write(playerData()->player_bytes_2.s.rest_state, state); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRestStateXp()

void Player::setRestStateXp ( uint32_t  xp)

Definition at line 1173 of file Player.cpp.

1173{ write(playerData()->rest_state_xp, xp); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setResurrect()

void Player::setResurrect ( )

Definition at line 7795 of file Player.cpp.

7796{
7797 resurrect();
7798
7799 setMoveRoot(false);
7803
7805}
void setFullHealthMana()
Definition Player.cpp:7784
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setResurrecterGuid()

void Player::setResurrecterGuid ( uint64_t  guid)

Definition at line 7774 of file Player.cpp.

7774{ m_resurrecter = guid; }
Here is the caller graph for this function:

◆ setResurrectHealth()

void Player::setResurrectHealth ( uint32_t  health)

Definition at line 7775 of file Player.cpp.

7775{ m_resurrectHealth = health; }
Here is the caller graph for this function:

◆ setResurrectInstanceId()

void Player::setResurrectInstanceId ( uint32_t  id)

Definition at line 7777 of file Player.cpp.

7777{ m_resurrectInstanceID = id; }
Here is the caller graph for this function:

◆ setResurrectMana()

void Player::setResurrectMana ( uint32_t  mana)

Definition at line 7776 of file Player.cpp.

7776{ m_resurrectMana = mana; }
Here is the caller graph for this function:

◆ setResurrectMapId()

void Player::setResurrectMapId ( uint32_t  id)

Definition at line 7778 of file Player.cpp.

7778{ m_resurrectMapId = id; }
Here is the caller graph for this function:

◆ setResurrectPosition()

void Player::setResurrectPosition ( LocationVector  position)

Definition at line 7779 of file Player.cpp.

7779{ m_resurrectPosition = position; }
Here is the caller graph for this function:

◆ setRoles()

void Player::setRoles ( uint8_t  role)

Definition at line 8580 of file Player.cpp.

8580{ m_roles = role; }

◆ setRuneRegen()

void Player::setRuneRegen ( uint8_t  rune,
float  regen 
)

Definition at line 1169 of file Player.cpp.

1169{ write(playerData()->rune_regen[rune], regen); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSanctuaryFlag()

void Player::setSanctuaryFlag ( )
overridevirtual

Reimplemented from Unit.

Definition at line 9863 of file Player.cpp.

9864{
9865#if VERSION_STRING > TBC
9866 addPvpFlags(PVP_STATE_FLAG_SANCTUARY);
9867#elif VERSION_STRING == TBC
9868 addPlayerFlags(PLAYER_FLAG_SANCTUARY);
9869#endif
9870
9872}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedGo()

void Player::setSelectedGo ( uint64_t  guid)

Definition at line 2352 of file Player.cpp.

2352{ m_GMSelectedGO = guid; }
Here is the caller graph for this function:

◆ setSelfResurrectSpell()

void Player::setSelfResurrectSpell ( uint32_t  spell)

Definition at line 1136 of file Player.cpp.

1136{ write(playerData()->self_resurrection_spell, spell); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSendOnlyRaidgroup()

void Player::setSendOnlyRaidgroup ( bool  set)

Definition at line 7954 of file Player.cpp.

◆ setServersideDrunkValue()

void Player::setServersideDrunkValue ( uint16_t  newDrunkValue,
uint32_t  itemId = 0 
)

Definition at line 11829 of file Player.cpp.

11830{
11831 const uint32_t oldDrunkenState = getDrunkStateByValue(m_serversideDrunkValue);
11832
11833 m_serversideDrunkValue = newDrunkenValue;
11835
11836 const uint32_t newDrunkenState = getDrunkStateByValue(m_serversideDrunkValue);
11837
11838 if (newDrunkenState == oldDrunkenState)
11839 return;
11840
11841 if (newDrunkenState >= DRUNKEN_DRUNK)
11843 else
11845
11847
11848 sendNewDrunkStatePacket(newDrunkenState, itemId);
11849}
@ INVIS_FLAG_DRUNK
void sendNewDrunkStatePacket(uint32_t state, uint32_t itemId)
Definition Player.cpp:9596
static PlayerBytes3_DrunkValue getDrunkStateByValue(uint16_t value)
Definition Player.cpp:11851
void modInvisibilityDetection(InvisibilityFlag flag, const int32_t amount)
Definition Unit.cpp:6225
int32_t getInvisibilityDetection(InvisibilityFlag flag) const
Definition Unit.cpp:6215
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSession()

void Player::setSession ( WorldSession session)

Definition at line 3132 of file Player.cpp.

3132{ m_session = session; }
Here is the caller graph for this function:

◆ setShieldBlock()

void Player::setShieldBlock ( uint32_t  value)

Definition at line 1114 of file Player.cpp.

1114{ write(playerData()->shield_block, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setShieldBlockCritPercentage()

void Player::setShieldBlockCritPercentage ( float  value)

Definition at line 1119 of file Player.cpp.

1119{ write(playerData()->shield_block_crit_pct, value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSkillInfoBonusPermanent()

void Player::setSkillInfoBonusPermanent ( uint32_t  index,
uint8_t  offset,
uint16_t  bonus 
)

Definition at line 1026 of file Player.cpp.

1026{ write(*(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_talent[index]) + offset), bonus); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSkillInfoBonusTemporary()

void Player::setSkillInfoBonusTemporary ( uint32_t  index,
uint8_t  offset,
uint16_t  bonus 
)

Definition at line 1025 of file Player.cpp.

1025{ write(*(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_mod[index]) + offset), bonus); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSkillInfoCurrentValue()

void Player::setSkillInfoCurrentValue ( uint32_t  index,
uint8_t  offset,
uint16_t  current 
)

Definition at line 1023 of file Player.cpp.

1023{ write(*(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_rank[index]) + offset), current); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSkillInfoId()

void Player::setSkillInfoId ( uint32_t  index,
uint8_t  offset,
uint16_t  id 
)

Definition at line 1021 of file Player.cpp.

1021{ write(*(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_line[index]) + offset), id); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSkillInfoMaxValue()

void Player::setSkillInfoMaxValue ( uint32_t  index,
uint8_t  offset,
uint16_t  max 
)

Definition at line 1024 of file Player.cpp.

1024{ write(*(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_max_rank[index]) + offset), max); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSkillInfoStep()

void Player::setSkillInfoStep ( uint32_t  index,
uint8_t  offset,
uint16_t  step 
)

Definition at line 1022 of file Player.cpp.

1022{ write(*(((uint16_t*)&playerData()->field_skill_info.skill_info_parts.skill_step[index]) + offset), step); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSkinColor()

void Player::setSkinColor ( uint8_t  color)

Definition at line 825 of file Player.cpp.

825{ write(playerData()->player_bytes.s.skin_color, color); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSpellCritFromSpell()

void Player::setSpellCritFromSpell ( float  value)
inline

Definition at line 2037 of file Player.hpp.

Here is the caller graph for this function:

◆ setSpellCritPercentage()

void Player::setSpellCritPercentage ( uint8_t  school,
float  value 
)

Definition at line 1111 of file Player.cpp.

1111{ write(playerData()->spell_crit_pct[school], value); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStableSlotCount()

void Player::setStableSlotCount ( uint8_t  count)

Definition at line 12662 of file Player.cpp.

◆ setSummonedObject()

void Player::setSummonedObject ( Object summonedObject)

Definition at line 12705 of file Player.cpp.

12705{ m_summonedObject = summonedObject; }
Here is the caller graph for this function:

◆ setTalentHearthOfWildPCT()

void Player::setTalentHearthOfWildPCT ( int  value)
inline

Definition at line 1958 of file Player.hpp.

Here is the caller graph for this function:

◆ setTalentPoints()

void Player::setTalentPoints ( uint32_t  talentPoints,
bool  forBothSpecs = true 
)

Definition at line 6017 of file Player.cpp.

6018{
6019 if (!forBothSpecs)
6020 getActiveSpec().setTalentPoints(talentPoints);
6021 else
6022 {
6023#ifndef FT_DUAL_SPEC
6024 getActiveSpec().setTalentPoints(talentPoints);
6025#else
6026 m_specs[SPEC_PRIMARY].setTalentPoints(talentPoints);
6027 m_specs[SPEC_SECONDARY].setTalentPoints(talentPoints);
6028#endif
6029 }
6030
6031#if VERSION_STRING < Cata
6032 // Send talent points also to client
6033 setFreeTalentPoints(talentPoints);
6034#endif
6035}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTalentPointsFromQuests()

void Player::setTalentPointsFromQuests ( uint32_t  talentPoints)

Definition at line 6147 of file Player.cpp.

6148{
6149 m_talentPointsFromQuests = talentPoints;
6150}
Here is the caller graph for this function:

◆ setTalentResetsCount()

void Player::setTalentResetsCount ( uint32_t  value)

Definition at line 6319 of file Player.cpp.

Here is the caller graph for this function:

◆ setTeam()

void Player::setTeam ( uint32_t  team)

Definition at line 2776 of file Player.cpp.

2776{ m_team = team; m_bgTeam = team; }
Here is the caller graph for this function:

◆ setTemporarilyUnsummonedPetsOffline()

void Player::setTemporarilyUnsummonedPetsOffline ( )

Definition at line 12633 of file Player.cpp.

12634{
12635 const auto copiedCachedSlots = m_cachedPetSlots;
12636 for (const auto& [slot, petId] : std::as_const(copiedCachedSlots))
12637 {
12638 // Just check active slots
12639 if (slot >= PET_SLOT_MAX_ACTIVE_SLOT)
12640 break;
12641
12642 auto* const petCache = getModifiablePetCache(petId);
12643 if (petCache == nullptr)
12644 continue;
12645
12646 if (petCache->active)
12647 {
12648 // Summoned pets can be completely deleted since they can be resummoned anyway
12649 if (petCache->type == PET_TYPE_HUNTER)
12650 petCache->active = false;
12651 else
12652 removePetCache(petCache->number);
12653 }
12654 }
12655}
void removePetCache(uint8_t petId)
Definition Player.cpp:12310
PetCache * getModifiablePetCache(uint8_t petId) const
Definition Player.cpp:12285
Definition g3dmath.h:935
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTrackCreature()

void Player::setTrackCreature ( uint32_t  id)

Definition at line 1076 of file Player.cpp.

1076{ write(playerData()->track_creatures, id); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTrackResource()

void Player::setTrackResource ( uint32_t  id)

Definition at line 1079 of file Player.cpp.

1079{ write(playerData()->track_resources, id); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTransferStatus()

void Player::setTransferStatus ( uint8_t  status)

Definition at line 1889 of file Player.cpp.

1889{ m_transferStatus = status; }
Here is the caller graph for this function:

◆ setTutorialValueForId()

void Player::setTutorialValueForId ( uint8_t  id,
uint32_t  value 
)

Definition at line 6341 of file Player.cpp.

6342{
6343 if (id < 8)
6344 {
6345 m_tutorials[id] = value;
6346 m_tutorialsDirty = true;
6347 }
6348}
Here is the caller graph for this function:

◆ setUpdateBits()

void Player::setUpdateBits ( UpdateMask updateMask,
Player target 
) const
protectedvirtual

Reimplemented from Object.

Definition at line 3572 of file Player.cpp.

3573{
3574 if (target == this)
3575 {
3576 Object::setUpdateBits(updateMask, target);
3577 }
3578 else
3579 {
3580 Object::setUpdateBits(updateMask, target);
3581 *updateMask &= Player::m_visibleUpdateMask;
3582 }
3583}
virtual void setUpdateBits(UpdateMask *updateMask, Player *target) const
Definition Object.cpp:3437
Here is the call graph for this function:

◆ setupPvPOnLogin()

void Player::setupPvPOnLogin ( )

Definition at line 8218 of file Player.cpp.

8219{
8221
8222 const auto areaTableEntry = this->GetArea();
8223
8224 if (areaTableEntry != nullptr && isAlive() &&
8225 (areaTableEntry->team == AREAC_CONTESTED ||
8226 (isTeamAlliance() && areaTableEntry->team == AREAC_HORDE_TERRITORY) ||
8227 (isTeamHorde() && areaTableEntry->team == AREAC_ALLIANCE_TERRITORY)))
8229}
#define PLAYER_HONORLESS_TARGET_SPELL
void eventExploration()
Definition Player.cpp:2200
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVanityPetSlotItemGuid()

void Player::setVanityPetSlotItemGuid ( uint8_t  slot,
uint64_t  guid 
)

Definition at line 967 of file Player.cpp.

967{ write(playerData()->vanity_pet_slot[slot], guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVendorBuybackSlot()

void Player::setVendorBuybackSlot ( uint8_t  slot,
uint64_t  guid 
)

Definition at line 958 of file Player.cpp.

958{ write(playerData()->vendor_buy_back_slot[slot], guid); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVisibleItemEnchantment()

void Player::setVisibleItemEnchantment ( uint32_t  slot,
uint8_t  pos,
uint32_t  enchantment 
)

Definition at line 941 of file Player.cpp.

941{ write(playerData()->visible_items[slot].enchantment[pos], enchantment); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVisibleItemEntry()

void Player::setVisibleItemEntry ( uint32_t  slot,
uint32_t  entry 
)

Definition at line 922 of file Player.cpp.

922{ write(playerData()->visible_items[slot].entry, entry); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVisibleItemFields()

void Player::setVisibleItemFields ( uint32_t  slot,
Item item 
)

Definition at line 9895 of file Player.cpp.

9896{
9897 if (item)
9898 {
9899 setVisibleItemEntry(slot, item->getVisibleEntry());
9900#if VERSION_STRING > TBC
9903#else
9904 for (uint8_t i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; ++i)
9906#endif
9907 }
9908 else
9909 {
9910 setVisibleItemEntry(slot, 0);
9911#if VERSION_STRING > TBC
9914#else
9915 for (uint8_t i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; ++i)
9916 setVisibleItemEnchantment(slot, i, 0);
9917#endif
9918 }
9919}
@ PERM_ENCHANTMENT_SLOT
@ TEMP_ENCHANTMENT_SLOT
@ MAX_INSPECTED_ENCHANTMENT_SLOT
uint32_t getVisibleEntry() const
Definition Item.cpp:998
void setVisibleItemEnchantment(uint32_t slot, uint8_t pos, uint32_t enchantment)
Definition Player.cpp:941
void setVisibleItemEntry(uint32_t slot, uint32_t entry)
Definition Player.cpp:922
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setWatchedFaction()

void Player::setWatchedFaction ( uint32_t  factionId)

Definition at line 1139 of file Player.cpp.

1139{ write(playerData()->field_watched_faction_idx, factionId); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setXp()

void Player::setXp ( uint32_t  xp)

Definition at line 994 of file Player.cpp.

994{ write(playerData()->xp, xp); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ smsg_TalentsInfo()

void Player::smsg_TalentsInfo ( bool  SendPetTalents)

Definition at line 6152 of file Player.cpp.

6153{
6154 // TODO: classic and tbc
6155#if VERSION_STRING < Mop
6156#if VERSION_STRING >= WotLK
6158 data << uint8_t(SendPetTalents ? 1 : 0);
6159 if (SendPetTalents)
6160 {
6161 if (getPet() != nullptr)
6163 return;
6164 }
6165 else
6166 {
6167 data << uint32_t(getActiveSpec().getTalentPoints()); // Free talent points
6168 data << uint8_t(m_talentSpecsCount); // How many specs player has
6169 data << uint8_t(m_talentActiveSpec); // Which spec is active right now
6170
6173
6174 // Loop through specs
6175 for (uint8_t specId = 0; specId < m_talentSpecsCount; ++specId)
6176 {
6177 PlayerSpec spec = m_specs[specId];
6178
6179#if VERSION_STRING >= Cata
6180 // Send primary talent tree
6182#endif
6183
6184 // How many talents player has learnt
6185 data << uint8_t(spec.getTalents().size());
6186 for (const auto& [talentId, rank] : spec.getTalents())
6187 {
6188 data << uint32_t(talentId);
6189 data << uint8_t(rank);
6190 }
6191
6192 // What kind of glyphs player has
6193 data << uint8_t(GLYPHS_COUNT);
6194 for (uint8_t i = 0; i < GLYPHS_COUNT; ++i)
6195 {
6196 data << uint16_t(getGlyph(specId, i));
6197 }
6198 }
6199 }
6200 getSession()->SendPacket(&data);
6201#endif
6202#else
6204 data << uint8_t(m_talentActiveSpec); // Which spec is active right now
6205 data.writeBits(m_talentSpecsCount, 19);
6206
6207 auto wpos = std::make_unique<size_t[]>(m_talentSpecsCount);
6208 for (int i = 0; i < m_talentSpecsCount; ++i)
6209 {
6210 wpos[i] = data.bitwpos();
6211 data.writeBits(0, 23);
6212 }
6213
6214 data.flushBits();
6215
6216 for (auto specId = 0; specId < m_talentSpecsCount; ++specId)
6217 {
6218 PlayerSpec spec = m_specs[specId];
6219
6220 for (uint8_t i = 0; i < 6; ++i)
6221 data << uint16_t(getGlyph(specId, i));
6222
6223 int32_t talentCount = 0;
6224 for (const auto& [talentId, rank] : spec.getTalents())
6225 {
6226 data << uint16_t(talentId);
6227 talentCount++;
6228 }
6229 data.PutBits(wpos[specId], talentCount, 23);
6230 data << uint32_t(spec.getTalentPoints());
6231 }
6232
6233 getSession()->SendPacket(&data);
6234#endif
6235}
@ SMSG_UPDATE_TALENT_DATA
Definition Opcodes.hpp:1348
void SendTalentsToOwner()
Definition Pet.cpp:1774
std::map< uint32_t, uint8_t > const & getTalents() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ softDisconnect()

void Player::softDisconnect ( )

Definition at line 3147 of file Player.cpp.

3148{
3149 sEventMgr.RemoveEvents(this, EVENT_PLAYER_SOFT_DISCONNECT);
3150
3151 if (m_session)
3152 m_session->LogoutPlayer(true);
3153}
@ EVENT_PLAYER_SOFT_DISCONNECT
Zack 2007 06 08: After player not pushing release spirit for 6 minutes while dead.
Definition EventMgr.h:65
Here is the call graph for this function:
Here is the caller graph for this function:

◆ spawnCorpseBody()

void Player::spawnCorpseBody ( )

Definition at line 7508 of file Player.cpp.

7509{
7510 if (const auto corpse = sObjectMgr.getCorpseByOwner(this->getGuidLow()))
7511 {
7512 if (!corpse->IsInWorld())
7513 {
7514 if (m_lootableOnCorpse && corpse->getDynamicFlags() != 1)
7515 corpse->setDynamicFlags(1);
7516
7517 if (m_WorldMap == nullptr)
7518 corpse->AddToWorld();
7519 else
7520 corpse->PushToWorld(m_WorldMap);
7521 }
7522
7523 setCorpseData(corpse->GetPosition(), corpse->GetInstanceID());
7524 }
7525 else
7526 {
7527 setCorpseData({ 0, 0, 0, 0 }, 0);
7528 }
7529}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ spawnCorpseBones()

void Player::spawnCorpseBones ( )

Definition at line 7531 of file Player.cpp.

7532{
7533 setCorpseData({ 0, 0, 0, 0 }, 0);
7534
7535 if (const auto corpse = sObjectMgr.getCorpseByOwner(getGuidLow()))
7536 {
7537 if (corpse->IsInWorld() && corpse->getCorpseState() == CORPSE_STATE_BODY)
7538 {
7539 corpse->spawnBones();
7540 sObjectMgr.addCorpseDespawnTime(corpse);
7541 }
7542 }
7543}
@ CORPSE_STATE_BODY
Definition Corpse.hpp:15
Here is the call graph for this function:
Here is the caller graph for this function:

◆ spawnPet()

void Player::spawnPet ( uint8_t  petId)

Definition at line 12538 of file Player.cpp.

12539{
12540 const auto itr = m_cachedPets.find(petId);
12541 if (itr == m_cachedPets.cend())
12542 {
12543 sLogger.failure("Player::spawnPet : {} tried to load invalid pet {}", std::to_string(getGuid()), petId);
12544 return;
12545 }
12546
12547 if (itr->second.get()->slot >= PET_SLOT_MAX_ACTIVE_SLOT)
12548 {
12549 sLogger.debug("Player::spawnPet : {} tried to spawn pet from stable slot {}", std::to_string(getGuid()), std::to_string(itr->second.get()->slot));
12550 return;
12551 }
12552
12553 _spawnPet(itr->second.get());
12554}
void _spawnPet(PetCache const *petCache)
Definition Player.cpp:12707
Here is the call graph for this function:
Here is the caller graph for this function:

◆ speedCheatDelay()

void Player::speedCheatDelay ( uint32_t  delay)

Definition at line 9369 of file Player.cpp.

9370{
9371 m_speedCheatDetector->SkipSamplingUntil(Util::getMSTime() + delay + getSession()->GetLatency() * 2 + 2000);
9372}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ speedCheatReset()

void Player::speedCheatReset ( )

Definition at line 9374 of file Player.cpp.

9375{
9376 m_speedCheatDetector->EventSpeedChange();
9377}
Here is the caller graph for this function:

◆ stopPvPTimer()

void Player::stopPvPTimer ( )

Definition at line 8216 of file Player.cpp.

8216{ m_pvpTimer = 0; }
Here is the caller graph for this function:

◆ storeItem()

Item * Player::storeItem ( LootItem const lootItem)

Definition at line 11221 of file Player.cpp.

11222{
11223 auto add = getItemInterface()->FindItemLessMax(lootItem->itemId, lootItem->count, false);
11224
11225 // Can we Store our New item?
11226 if (const uint8_t error = getItemInterface()->CanReceiveItem(lootItem->itemproto, lootItem->count) && !add)
11227 {
11228 getItemInterface()->buildInventoryChangeError(nullptr, nullptr, error, lootItem->itemId);
11229 return nullptr;
11230 }
11231
11232 const auto slotResult = getItemInterface()->FindFreeInventorySlot(lootItem->itemproto);
11233 if (!slotResult.Result && !add)
11234 {
11236 return nullptr;
11237 }
11238
11239 // Players which should be able to receive the item after its looted while tradeable
11240 LooterSet looters = lootItem->getAllowedLooters();
11241
11242 if (add == nullptr)
11243 {
11244 // Create the Item
11245 auto newItemHolder = sObjectMgr.createItem(lootItem->itemId, this);
11246 if (newItemHolder == nullptr)
11247 return nullptr;
11248
11249 auto* newItem = newItemHolder.get();
11250 newItem->setStackCount(lootItem->count);
11251 newItem->setOwnerGuid(getGuid());
11252
11253 if (lootItem->iRandomProperty != nullptr)
11254 {
11255 newItem->setRandomPropertiesId(lootItem->iRandomProperty->ID);
11256 newItem->applyRandomProperties(false);
11257 }
11258 else if (lootItem->iRandomSuffix != nullptr)
11259 {
11260 newItem->setRandomSuffix(lootItem->iRandomSuffix->id);
11261 newItem->applyRandomProperties(false);
11262 }
11263
11264 const auto [addResult, _] = getItemInterface()->SafeAddItem(std::move(newItemHolder), slotResult.ContainerSlot, slotResult.Slot);
11265 if (addResult)
11266 {
11267 sendItemPushResultPacket(false, true, true, slotResult.ContainerSlot, slotResult.Slot, lootItem->count, newItem->getEntry(), newItem->getPropertySeed(), newItem->getRandomPropertiesId(), newItem->getStackCount());
11268 sQuestMgr.OnPlayerItemPickup(this, newItem);
11269#if VERSION_STRING > TBC
11270 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, newItem->getEntry(), lootItem->count, 0);
11271 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, newItem->getEntry(), lootItem->count, 0);
11272 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, newItem->getEntry(), lootItem->count);
11273#endif
11274 }
11275 else
11276 {
11277 return nullptr;
11278 }
11279
11280#if VERSION_STRING >= WotLK
11281 // Soulbound Tradeable
11282 if (looters.size() > 1 && lootItem->itemproto->MaxCount == 1 && newItem->isSoulbound())
11283 {
11284 newItem->setSoulboundTradeable(looters);
11285
11286 uint32_t* played = getPlayedTime();
11287 newItem->setCreatePlayedTime(played[1]);
11289 }
11290#endif
11291
11292 return newItem;
11293 }
11294 else
11295 {
11296 add->setStackCount(add->getStackCount() + lootItem->count);
11297 add->m_isDirty = true;
11298 add->setOwnerGuid(getGuid());
11299
11300 sendItemPushResultPacket(false, true, true, slotResult.ContainerSlot, slotResult.Slot, lootItem->count, add->getEntry(), add->getPropertySeed(), add->getRandomPropertiesId(), add->getStackCount());
11301 sQuestMgr.OnPlayerItemPickup(this, add);
11302#if VERSION_STRING > TBC
11303 updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, add->getEntry(), 1, 0);
11304#endif
11305 return add;
11306 }
11307}
@ INV_ERR_INVENTORY_FULL
std::set< uint32_t > LooterSet
SlotResult FindFreeInventorySlot(ItemProperties const *proto)
void addTradeableItem(Item *item)
Item * FindItemLessMax(uint32_t itemid, uint32_t cnt, bool IncBank)
Checks for stacks that didn't reached max capacity.
uint32_t * getPlayedTime()
Definition Player.cpp:2883
static int add(void *a, void *b, void *c)
Definition ltm_desc.c:207
static l_noret error(LoadState *S, const char *why)
Definition lundump.c:40
Here is the call graph for this function:
Here is the caller graph for this function:

◆ storeNewLootItem()

Item * Player::storeNewLootItem ( uint8_t  slot,
Loot loot 
)

Definition at line 11163 of file Player.cpp.

11164{
11165 Personaltem* questItem = nullptr;
11166 Personaltem* ffaItem = nullptr;
11167
11168 // Pick our loot from Loot Store
11169 LootItem* item = _loot->lootItemInSlot(slot, this, &questItem, &ffaItem);
11170
11171 if (!item)
11172 {
11174 return nullptr;
11175 }
11176
11177 // questitems use the blocked field for other purposes
11178 if (!questItem && item->is_blocked)
11179 {
11180 sendPacket(SmsgLootReleaseResponse(getLootGuid(), 1).serialise().get());
11181 return nullptr;
11182 }
11183
11184 // Add our Item
11185 Item* newItem = storeItem(item);
11186 if (!newItem)
11187 return nullptr;
11188
11189 if (questItem)
11190 {
11191 questItem->is_looted = true;
11192 //freeforall is 1 if everyone's supposed to get the quest item.
11193 if (item->is_ffa || _loot->getPlayerQuestItems().size() == 1)
11194 getSession()->SendPacket(SmsgLootRemoved(slot).serialise().get());
11195 else
11196 _loot->itemRemoved(questItem->index);
11197 }
11198 else
11199 {
11200 if (ffaItem)
11201 {
11202 //freeforall case, notify only one player of the removal
11203 ffaItem->is_looted = true;
11204 getSession()->SendPacket(SmsgLootRemoved(slot).serialise().get());
11205 }
11206 else
11207 {
11208 _loot->itemRemoved(slot);
11209 }
11210 }
11211
11212 //if only one person is supposed to loot the item, then set it to looted
11213 if (!item->is_ffa)
11214 item->is_looted = true;
11215
11216 --_loot->unlootedCount;
11217
11218 return newItem;
11219}
@ INV_ERR_ALREADY_LOOTED
Item * storeItem(LootItem const *lootItem)
Definition Player.cpp:11221
const uint64_t & getLootGuid() const
Definition Player.cpp:10787
bool is_blocked
Definition LootItem.hpp:76
bool is_ffa
Definition LootItem.hpp:78
uint8_t index
Definition Loot.hpp:21
bool is_looted
Definition Loot.hpp:22
Here is the call graph for this function:
Here is the caller graph for this function:

◆ subtractRestXp()

uint32_t Player::subtractRestXp ( uint32_t  amount)

Definition at line 12206 of file Player.cpp.

12207{
12208 if (getLevel() >= getMaxLevel())
12209 amount = 0;
12210
12211 const int32_t restAmount = m_restAmount - (amount << 1);
12212 if (restAmount < 0)
12213 m_restAmount = 0;
12214 else
12215 m_restAmount = restAmount;
12216
12217 sLogger.debug("Subtracted {} rest XP to a total of {}", amount, m_restAmount);
12218
12220
12221 return amount;
12222}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ summonTemporarilyUnsummonedPet()

void Player::summonTemporarilyUnsummonedPet ( )

Definition at line 12556 of file Player.cpp.

12557{
12558 if (getPet() != nullptr)
12559 return;
12560
12562 return;
12563
12564 for (const auto& [slot, petId] : std::as_const(m_cachedPetSlots))
12565 {
12566 // Just check active slots
12567 if (slot >= PET_SLOT_MAX_ACTIVE_SLOT)
12568 break;
12569
12570 auto* const petCache = getModifiablePetCache(petId);
12571 if (petCache != nullptr && petCache->active)
12572 {
12573 // If active pet is not alive it cant be summoned now
12574 // Player must explicitly summon and revive it
12575 if (petCache->alive)
12576 _spawnPet(petCache);
12577 else
12578 petCache->active = false;
12579
12580 return;
12581 }
12582 }
12583}
bool isPetRequiringTemporaryUnsummon() const
Definition Player.cpp:12593
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tagUnit()

void Player::tagUnit ( Object object)

Definition at line 10156 of file Player.cpp.

10157{
10158 if (object->isCreatureOrPlayer())
10159 {
10160#if VERSION_STRING < Mop
10161 object->forceBuildUpdateValueForField(getOffsetForStructuredField(WoWUnit, dynamic_flags), this);
10162#else
10163 object->forceBuildUpdateValueForField(getOffsetForStructuredField(WoWObject, dynamic_field), this);
10164#endif
10165 }
10166}
Here is the call graph for this function:

◆ teleport()

bool Player::teleport ( const LocationVector vec,
WorldMap map 
)

Definition at line 1742 of file Player.cpp.

1743{
1744 if (map)
1745 {
1746 if (map->getPlayer(this->getGuidLow()))
1747 {
1748 this->SetPosition(vec);
1749 }
1750 else
1751 {
1752 if (map->getBaseMap()->getMapId() == 530 && !this->getSession()->HasFlag(ACCOUNT_FLAG_XPACK_01))
1753 return false;
1754
1755 if (map->getBaseMap()->getMapId() == 571 && !this->getSession()->HasFlag(ACCOUNT_FLAG_XPACK_02))
1756 return false;
1757
1758 this->safeTeleport(map, vec);
1759 }
1760
1761 return true;
1762 }
1763
1764 return false;
1765}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ testDuelBoundary()

void Player::testDuelBoundary ( )

Definition at line 11914 of file Player.cpp.

11915{
11916 if (!IsInWorld())
11917 return;
11918
11919 WoWGuid wowGuid;
11920 wowGuid.Init(getDuelArbiter());
11921
11922 if (GameObject* goFlag = getWorldMap()->getGameObject(wowGuid.getGuidLowPart()))
11923 {
11924 if (CalcDistance(goFlag) > 75.0f)
11925 {
11927 {
11928 m_duelCountdownTimer -= 500;
11929 if (m_duelCountdownTimer == 0)
11931 }
11932 else
11933 {
11934 m_duelCountdownTimer = 10000;
11935
11938 }
11939 }
11940 else
11941 {
11943 {
11944 sendPacket(SmsgDuelInbounds().serialise().get());
11946 }
11947 }
11948 }
11949 else
11950 {
11952 }
11953}
@ DUEL_STATUS_INBOUNDS
@ DUEL_STATUS_OUTOFBOUNDS
GameObject * getGameObject(uint32_t spellId) const
Definition Unit.cpp:8702
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toggleAfk()

void Player::toggleAfk ( )

Definition at line 2854 of file Player.cpp.

2855{
2857 {
2859 if (worldConfig.getKickAFKPlayerTime())
2860 sEventMgr.RemoveEvents(this, EVENT_PLAYER_SOFT_DISCONNECT);
2861 }
2862 else
2863 {
2865
2866 if (m_bg)
2867 m_bg->removePlayer(this, false);
2868
2869 if (worldConfig.getKickAFKPlayerTime())
2871 worldConfig.getKickAFKPlayerTime(), 1, 0);
2872 }
2873}
void softDisconnect()
Definition Player.cpp:3147
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toggleDnd()

void Player::toggleDnd ( )

Definition at line 2875 of file Player.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ togglePvP()

void Player::togglePvP ( )

Definition at line 8343 of file Player.cpp.

8344{
8345 if (sLogonCommHandler.getRealmType() == REALMTYPE_NORMAL || sLogonCommHandler.getRealmType() == REALMTYPE_RP)
8346 {
8347 if (m_pvpTimer > 0)
8348 {
8349 stopPvPTimer();
8350
8352#if VERSION_STRING >= WotLK
8353 removePlayerFlags(PLAYER_FLAG_PVP_TIMER);
8354#endif
8355
8356 if (!isPvpFlagSet())
8357 setPvpFlag();
8358 }
8359 else
8360 {
8361 if (isPvpFlagSet())
8362 {
8363 auto areaTableEntry = this->GetArea();
8364 if (areaTableEntry && (areaTableEntry->flags & AREA_CITY_AREA || areaTableEntry->flags & AREA_CITY))
8365 {
8366 if ((areaTableEntry->team == AREAC_ALLIANCE_TERRITORY && isTeamHorde()) || (areaTableEntry->team == AREAC_HORDE_TERRITORY && isTeamAlliance()))
8367 {
8368 }
8369 else
8370 {
8371 resetPvPTimer();
8372 }
8373 }
8374 else
8375 {
8376 resetPvPTimer();
8377 }
8378
8380#if VERSION_STRING >= WotLK
8381 addPlayerFlags(PLAYER_FLAG_PVP_TIMER);
8382#endif
8383 }
8384 else
8385 {
8387#if VERSION_STRING >= WotLK
8388 removePlayerFlags(PLAYER_FLAG_PVP_TIMER);
8389#endif
8390
8391 stopPvPTimer();
8392 setPvpFlag();
8393 }
8394 }
8395 }
8396 else if (sLogonCommHandler.getRealmType() == REALMTYPE_PVP || sLogonCommHandler.getRealmType() == REALMTYPE_RPPVP)
8397 {
8398 auto at = this->GetArea();
8399 if (at == nullptr)
8400 return;
8401
8402 // This is where all the magic happens :P
8403 if ((at->team == AREAC_ALLIANCE_TERRITORY && isTeamAlliance()) || (at->team == AREAC_HORDE_TERRITORY && isTeamHorde()))
8404 {
8405 if (m_pvpTimer > 0)
8406 {
8407 // Means that we typed /pvp while we were "cooling down". Stop the timer.
8408 stopPvPTimer();
8409
8411#if VERSION_STRING >= WotLK
8412 removePlayerFlags(PLAYER_FLAG_PVP_TIMER);
8413#endif
8414
8415 if (!isPvpFlagSet())
8416 setPvpFlag();
8417 }
8418 else
8419 {
8420 if (isPvpFlagSet())
8421 {
8422 // Start the "cooldown" timer.
8423 resetPvPTimer();
8424
8426#if VERSION_STRING >= WotLK
8427 addPlayerFlags(PLAYER_FLAG_PVP_TIMER);
8428#endif
8429 }
8430 else
8431 {
8432 // Move into PvP state.
8434#if VERSION_STRING >= WotLK
8435 removePlayerFlags(PLAYER_FLAG_PVP_TIMER);
8436#endif
8437
8438 stopPvPTimer();
8439 setPvpFlag();
8440 }
8441 }
8442 }
8443 else
8444 {
8445 if (at->zone)
8446 {
8448 if (at2 && ((at2->team == AREAC_ALLIANCE_TERRITORY && isTeamAlliance()) || (at2->team == AREAC_HORDE_TERRITORY && isTeamHorde())))
8449 {
8450 if (m_pvpTimer > 0)
8451 {
8452 // Means that we typed /pvp while we were "cooling down". Stop the timer.
8453 stopPvPTimer();
8454
8456#if VERSION_STRING >= WotLK
8457 removePlayerFlags(PLAYER_FLAG_PVP_TIMER);
8458#endif
8459
8460 if (!isPvpFlagSet())
8461 setPvpFlag();
8462 }
8463 else
8464 {
8465 if (isPvpFlagSet())
8466 {
8467 // Start the "cooldown" timer.
8468 resetPvPTimer();
8469
8471#if VERSION_STRING >= WotLK
8472 addPlayerFlags(PLAYER_FLAG_PVP_TIMER);
8473#endif
8474 }
8475 else
8476 {
8477 // Move into PvP state.
8479#if VERSION_STRING >= WotLK
8480 removePlayerFlags(PLAYER_FLAG_PVP_TIMER);
8481#endif
8482
8483 stopPvPTimer();
8484 setPvpFlag();
8485 }
8486 }
8487 return;
8488 }
8489 }
8490
8492 {
8494#if VERSION_STRING >= WotLK
8495 removePlayerFlags(PLAYER_FLAG_PVP_TIMER);
8496#endif
8497 }
8498 else
8499 {
8501#if VERSION_STRING >= WotLK
8502 addPlayerFlags(PLAYER_FLAG_PVP_TIMER);
8503#endif
8504 }
8505 }
8506 }
8507}
#define sLogonCommHandler
@ REALMTYPE_NORMAL
@ REALMTYPE_PVP
@ REALMTYPE_RPPVP
@ REALMTYPE_RP
void resetPvPTimer()
Definition Player.cpp:8215
void setPvpFlag() override
Definition Player.cpp:9790
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toggleXpGain()

void Player::toggleXpGain ( )

Definition at line 12203 of file Player.cpp.

Here is the caller graph for this function:

◆ tryPutPetToSlot()

bool Player::tryPutPetToSlot ( uint8_t  petId,
uint8_t  newSlot,
bool  sendErrors = true 
)

Definition at line 12380 of file Player.cpp.

12381{
12382 const auto petItr = std::as_const(m_cachedPets).find(petId);
12383 if (petItr == m_cachedPets.cend())
12384 {
12385 if (sendErrors)
12387
12388 return false;
12389 }
12390
12391 // Check if pet is being tried to move to same slot where it is already
12392 if (petItr->second->slot == newSlot)
12393 {
12394 if (sendErrors)
12396
12397 return false;
12398 }
12399
12400 auto* oldSlotPet = petItr->second.get();
12401 // Pet that possibly exists in new slot
12402 PetCache* newSlotPet = nullptr;
12403
12404 const auto slotItr = std::as_const(m_cachedPetSlots).find(newSlot);
12405 if (slotItr != m_cachedPetSlots.cend())
12406 {
12407 const auto existingPetItr = std::as_const(m_cachedPets).find(slotItr->second);
12408 if (existingPetItr != m_cachedPets.cend())
12409 newSlotPet = existingPetItr->second.get();
12410 }
12411
12412 const auto isOldSlotActiveSlot = oldSlotPet->slot < PET_SLOT_MAX_ACTIVE_SLOT;
12413 const auto isNewSlotActiveSlot = newSlot < PET_SLOT_MAX_ACTIVE_SLOT;
12414
12415#if VERSION_STRING >= WotLK
12416 if (isNewSlotActiveSlot)
12417 {
12418 // Check if player can have exotic pets when taking pet from stables
12419 if (const auto creatureProperties = sMySQLStore.getCreatureProperties(oldSlotPet->entry))
12420 {
12421 if (creatureProperties->isExotic() && !hasAuraWithAuraEffect(SPELL_AURA_ALLOW_TAME_PET_TYPE))
12422 {
12423 if (sendErrors)
12425
12426 return false;
12427 }
12428 }
12429 }
12430
12431 if (isOldSlotActiveSlot && !isNewSlotActiveSlot && newSlotPet != nullptr)
12432 {
12433 // Check also if pet in new slot is exotic if player is swapping pet slots
12434 if (const auto creatureProperties = sMySQLStore.getCreatureProperties(newSlotPet->entry))
12435 {
12436 if (creatureProperties->isExotic() && !hasAuraWithAuraEffect(SPELL_AURA_ALLOW_TAME_PET_TYPE))
12437 {
12438 if (sendErrors)
12440
12441 return false;
12442 }
12443 }
12444 }
12445#endif
12446
12447 if (!isNewSlotActiveSlot)
12448 {
12449 // Must be hunter pet
12450 if (oldSlotPet->type != PET_TYPE_HUNTER)
12451 {
12452 if (sendErrors)
12454
12455 return false;
12456 }
12457 }
12458
12459 m_cachedPetSlots.insert_or_assign(newSlot, petId);
12460 if (newSlotPet != nullptr)
12461 m_cachedPetSlots.insert_or_assign(oldSlotPet->slot, newSlotPet->number);
12462 else
12463 m_cachedPetSlots.erase(oldSlotPet->slot);
12464
12465 // Update only slot in pet cache, full update is done in possible summon/unsummon
12466 if (newSlotPet != nullptr)
12467 newSlotPet->slot = oldSlotPet->slot;
12468 oldSlotPet->slot = newSlot;
12469
12470 auto requiresPetSave = false;
12471 if (isOldSlotActiveSlot && !isNewSlotActiveSlot)
12472 {
12473 // Active pet is put to stables
12474 auto* const currentPet = getPet();
12475 if (currentPet != nullptr && currentPet->getPetId() == petId)
12476 {
12477 currentPet->unSummon();
12478 if (newSlotPet != nullptr && !isPetRequiringTemporaryUnsummon() && newSlotPet->alive)
12479 _spawnPet(newSlotPet);
12480 }
12481 else
12482 {
12483 // If this pet was temporary unsummoned make the other pet active as well
12484 if (newSlotPet != nullptr)
12485 newSlotPet->active = oldSlotPet->active;
12486 oldSlotPet->active = false;
12487 requiresPetSave = true;
12488 }
12489 }
12490 else if (!isOldSlotActiveSlot && isNewSlotActiveSlot)
12491 {
12492 // Pet is taken from stables
12493 if (newSlotPet != nullptr)
12494 {
12495 auto* const currentPet = getPet();
12496 // Only summon it if it's put to same slot as current summoned pet
12497 if (currentPet != nullptr && currentPet->getPetId() == newSlotPet->number)
12498 {
12499 currentPet->unSummon();
12500 if (!isPetRequiringTemporaryUnsummon() && oldSlotPet->alive)
12501 _spawnPet(oldSlotPet);
12502 }
12503 else
12504 {
12505 // If pet from new slot was temporary unsummoned make this pet active as well
12506 oldSlotPet->active = newSlotPet->active;
12507 newSlotPet->active = false;
12508 requiresPetSave = true;
12509 }
12510 }
12511 else
12512 {
12513 requiresPetSave = true;
12514 }
12515 }
12516 else if ((!isOldSlotActiveSlot && !isNewSlotActiveSlot) || (isOldSlotActiveSlot && isNewSlotActiveSlot))
12517 {
12518 // Pet is either moved inside stables or its active slot was changed
12519 // In either case unsummon is not required, just save pets to database
12520 requiresPetSave = true;
12521 }
12522
12523 if (requiresPetSave)
12524 {
12525 // Save only slot and active fields
12526 CharacterDatabase.Execute("UPDATE playerpets SET slot = %u, active = %u WHERE ownerguid = %u AND petnumber = %u",
12527 oldSlotPet->slot, oldSlotPet->active, getGuidLow(), oldSlotPet->number);
12528 if (newSlotPet != nullptr)
12529 {
12530 CharacterDatabase.Execute("UPDATE playerpets SET slot = %u, active = %u WHERE ownerguid = %u AND petnumber = %u",
12531 newSlotPet->slot, newSlotPet->active, getGuidLow(), newSlotPet->number);
12532 }
12533 }
12534
12535 return true;
12536}
@ SPELL_AURA_ALLOW_TAME_PET_TYPE
uint32_t entry
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unbindInstance() [1/2]

void Player::unbindInstance ( BoundInstancesMap::iterator &  itr,
InstanceDifficulty::Difficulties  difficulty,
bool  unload = false 
)

Definition at line 12837 of file Player.cpp.

12838{
12839 if (itr != m_boundInstances[difficulty].end())
12840 {
12841 if (!unload)
12842 {
12843 CharacterDatabase.Execute("DELETE FROM character_instance WHERE guid = %u AND instance = %u", getGuidLow(), itr->second.save->getInstanceId());
12844 }
12845
12846#if VERSION_STRING > TBC
12847 if (itr->second.perm)
12848 getSession()->sendCalendarRaidLockout(itr->second.save, false);
12849#endif
12850 itr->second.save->removePlayer(this); // save can become invalid
12851 m_boundInstances[difficulty].erase(itr++);
12852 }
12853}
Here is the call graph for this function:

◆ unbindInstance() [2/2]

void Player::unbindInstance ( uint32_t  mapid,
InstanceDifficulty::Difficulties  difficulty,
bool  unload = false 
)

Definition at line 12831 of file Player.cpp.

12832{
12833 BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
12834 unbindInstance(itr, difficulty, unload);
12835}
void unbindInstance(uint32_t mapid, InstanceDifficulty::Difficulties difficulty, bool unload=false)
Definition Player.cpp:12831
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unEquipOffHandIfRequired()

void Player::unEquipOffHandIfRequired ( )

Definition at line 6576 of file Player.cpp.

6577{
6579 if (offHandWeapon == nullptr)
6580 return;
6581
6582 auto needToRemove = true;
6583 // Check if player has a two-handed weapon in offhand
6584 if (offHandWeapon->getItemProperties()->InventoryType == INVTYPE_2HWEAPON)
6585 {
6586 needToRemove = !canDualWield2H();
6587 }
6588 else
6589 {
6590 // Player has something in offhand, check if main hand is a two-handed weapon
6591 const auto mainHandWeapon = getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_MAINHAND);
6592 if (mainHandWeapon != nullptr && mainHandWeapon->getItemProperties()->InventoryType == INVTYPE_2HWEAPON)
6593 needToRemove = !canDualWield2H();
6594 else
6595 {
6596 // Main hand nor offhand is a two-handed weapon, check if player can dual wield one-handed weapons
6597 if (offHandWeapon->isWeapon())
6598 needToRemove = !canDualWield();
6599 else
6600 needToRemove = false; // Offhand is not a weapon
6601 }
6602 }
6603
6604 if (!needToRemove)
6605 return;
6606
6607 // Unequip offhand and find a bag slot for it
6609 auto result = getItemInterface()->FindFreeInventorySlot(offHandWeapon->getItemProperties());
6610 if (!result.Result)
6611 {
6612 // Player has no free slots in inventory, send it by mail
6613 offHandWeapon->removeFromWorld();
6614 offHandWeapon->setOwner(nullptr);
6615 offHandWeapon->saveToDB(INVENTORY_SLOT_NOT_SET, 0, true, nullptr);
6616 sMailSystem.SendAutomatedMessage(MAIL_TYPE_NORMAL, getGuid(), getGuid(), "There were troubles with your item.", "There were troubles storing your item into your inventory.", 0, 0, offHandWeapon->getGuidLow(), MAIL_STATIONERY_GM);
6617 }
6618 else
6619 {
6620 auto [addResult, returnedItem] = getItemInterface()->SafeAddItem(std::move(offHandWeaponHolder), result.ContainerSlot, result.Slot);
6621 if (!addResult)
6622 {
6623 // TODO: if add fails, should item be sent in mail? now it's destroyed
6624 getItemInterface()->AddItemToFreeSlot(std::move(returnedItem));
6625 }
6626 }
6627}
@ INVTYPE_2HWEAPON
@ MAIL_TYPE_NORMAL
Definition MailMgr.h:56
@ MAIL_STATIONERY_GM
Definition MailMgr.h:88
#define sMailSystem
Definition MailMgr.h:189
std::unique_ptr< Item > SafeRemoveAndRetreiveItemFromSlot(int8_t ContainerSlot, int16_t slot, bool destroy)
Removes the item safely and returns it back for usage.
bool canDualWield2H() const
Definition Player.cpp:4261
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unsetBanned()

void Player::unsetBanned ( )

Definition at line 2341 of file Player.cpp.

2341{ m_banned = 0; }
Here is the caller graph for this function:

◆ unsetCharter()

void Player::unsetCharter ( uint8_t  charterType)

Definition at line 7835 of file Player.cpp.

7835{ m_charters[charterType] = nullptr; }

◆ unSummonPetTemporarily()

void Player::unSummonPetTemporarily ( )

Definition at line 12585 of file Player.cpp.

12586{
12587 if (getPet() == nullptr)
12588 return;
12589
12591}
void unSummonTemporarily()
Definition Pet.cpp:416
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update()

void Player::Update ( unsigned long  time_passed)

Definition at line 290 of file Player.cpp.

291{
292 if (getSession() && !getSession()->GetSocket())
293 {
294 getSession()->LogoutPlayer(false);
295 return;
296 }
297
298 if (!IsInWorld())
299 return;
300
301 Unit::Update(time_passed);
302 uint32_t mstime = Util::getMSTime();
303
304 if (m_attacking)
305 {
306 // Check attack timer.
307 if (isAttackReady(MELEE))
308 _eventAttack(false);
309
311 _eventAttack(true);
312 }
313
314 // Breathing
316 {
317 // keep subtracting timer
319 {
320 // not taking dmg yet
321 if (time_passed >= m_underwaterTime)
323 else
324 m_underwaterTime -= time_passed;
325 }
326
327 if (!m_underwaterTime)
328 {
329 // check last damage dealt timestamp, and if enough time has elapsed deal damage
330 if (mstime >= m_underwaterLastDamage)
331 {
332 uint32_t damage = getMaxHealth() / 10;
333
336 m_underwaterLastDamage = mstime + 1000;
337 }
338 }
339 }
340 else
341 {
342 // check if we're not on a full breath timer
344 {
345 // regenning
346 m_underwaterTime += (time_passed * 10);
347
349 {
352 }
353 }
354 }
355
356 // Lava Damage
358 {
359 // check last damage dealt timestamp, and if enough time has elapsed deal damage
360 if (mstime >= m_underwaterLastDamage)
361 {
362 uint32_t damage = getMaxHealth() / 5;
363
366 m_underwaterLastDamage = mstime + 1000;
367 }
368 }
369
370 // Autosave
371 if (mstime >= m_nextSave)
372 saveToDB(false);
373
374 // Exploration
375 if (mstime >= m_explorationTimer)
376 {
378 m_explorationTimer = mstime + 3000;
379 }
380
381 // Autocast Spells in Area
382 if (time_passed >= m_spellAreaUpdateTimer)
383 {
386 }
387 else
388 {
389 m_spellAreaUpdateTimer -= static_cast<uint16_t>(time_passed);
390 }
391
392 if (m_pvpTimer)
393 {
394 if (time_passed >= m_pvpTimer)
395 {
397 m_pvpTimer = 0;
398 }
399 else
400 m_pvpTimer -= time_passed;
401 }
402
403 indoorCheckUpdate(mstime);
404
406 {
407 m_drunkTimer += time_passed;
408
409 if (m_drunkTimer > 10000)
411 }
412
413 // Instance Hourly Limit
414 if (!m_instanceResetTimes.empty())
415 {
416 time_t now = Util::getTimeNow();
417 for (InstanceTimeMap::iterator itr = m_instanceResetTimes.begin(); itr != m_instanceResetTimes.end();)
418 {
419 if (itr->second < now)
420 m_instanceResetTimes.erase(itr++);
421 else
422 ++itr;
423 }
424 }
425
426 // Instance Binds
427 if (hasPendingBind())
428 {
429 if (m_pendingBindTimer <= time_passed)
430 {
431 // Player left the instance
432 if (m_pendingBindId == static_cast<uint32_t>(GetInstanceID()))
434 setPendingBind(0, 0);
435 }
436 else
437 {
438 m_pendingBindTimer -= time_passed;
439 }
440 }
441
442 if (m_timeSyncTimer > 0)
443 {
444 if (time_passed >= m_timeSyncTimer)
445 sendTimeSync();
446 else
447 m_timeSyncTimer -= time_passed;
448 }
449
450 if (time_passed >= m_partyUpdateTimer)
451 {
453 m_partyUpdateTimer = 1000;
454 }
455 else
456 {
457 m_partyUpdateTimer -= static_cast<uint16_t>(time_passed);
458 }
459
460 // Update items
461 if (m_itemUpdateTimer >= 1000)
462 {
466 }
467 else
468 {
469 m_itemUpdateTimer += time_passed;
470 }
471}
@ UNDERWATERSTATE_LAVA
@ DAMAGE_LAVA
@ DAMAGE_DROWNING
void update(uint32_t timePassed)
void handleSobering()
Definition Player.cpp:11865
void removePvpFlag() override
Definition Player.cpp:9806
uint16_t m_spellAreaUpdateTimer
Definition Player.hpp:1913
void setPendingBind(uint32_t instanceId, uint32_t bindTimer)
Definition Player.cpp:12921
uint32_t m_itemUpdateTimer
Definition Player.hpp:1916
uint16_t m_partyUpdateTimer
Definition Player.hpp:1915
bool hasPendingBind() const
Definition Player.hpp:2138
void indoorCheckUpdate(uint32_t time)
Definition Player.cpp:2023
void saveToDB(bool newCharacter)
Definition Player.cpp:14132
void sendTimeSync()
Definition Player.cpp:10322
void _eventAttack(bool offhand)
Definition Player.cpp:13615
void sendUpdateToOutOfRangeGroupMembers()
Definition Player.cpp:7933
bool hasOffHandWeapon() const
Definition Player.cpp:6629
void _castSpellArea()
Definition Player.cpp:13528
void Update(unsigned long time_passed)
Definition Unit.cpp:157
void sendEnvironmentalDamageLogPacket(uint64_t guid, uint8_t type, uint32_t damage, uint64_t unk=0)
Definition Unit.cpp:6935
bool isAttackReady(WeaponDamageType type) const
Definition Unit.cpp:6912
void addSimpleEnvironmentalDamageBatchEvent(EnviromentalDamage type, uint32_t damage, uint32_t absorbedDamage=0)
Definition Unit.cpp:7381
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateArenaPoints()

void Player::updateArenaPoints ( )

Definition at line 8117 of file Player.cpp.

8118{
8119#if VERSION_STRING > Classic
8120#if VERSION_STRING < Cata
8121 this->setArenaCurrency(this->m_arenaPoints);
8122#endif
8123#endif
8124
8125 this->updateKnownCurrencies(43307, true);
8126}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateAttackSpeed()

void Player::updateAttackSpeed ( )

Definition at line 15504 of file Player.cpp.

15505{
15506 uint32_t speed = 2000;
15507
15508 if (getShapeShiftForm() == FORM_CAT)
15509 speed = 1000;
15511 speed = 2500;
15512 else if (!m_isDisarmed)
15513 if (const auto* itemWeapon = getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_MAINHAND))
15514 speed = itemWeapon->getItemProperties()->Delay;
15515
15516 setBaseAttackTime(MELEE, static_cast<uint32_t>(static_cast<float>(speed) / (getAttackSpeedModifier(MELEE) * (1.0f + calcRating(CR_HASTE_MELEE) / 100.0f))));
15517
15518 const auto* offhandWeapon = getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_OFFHAND);
15519 if (offhandWeapon && offhandWeapon->getItemProperties()->Class == ITEM_CLASS_WEAPON)
15520 {
15521 speed = offhandWeapon->getItemProperties()->Delay;
15522 setBaseAttackTime(OFFHAND, static_cast<uint32_t>(static_cast<float>(speed) / (getAttackSpeedModifier(OFFHAND) * (1.0f + calcRating(CR_HASTE_MELEE) / 100.0f))));
15523 }
15524
15525 if (const auto* rangedWeapon = getItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_RANGED))
15526 {
15527 speed = rangedWeapon->getItemProperties()->Delay;
15528 setBaseAttackTime(RANGED, static_cast<uint32_t>(static_cast<float>(speed) / (getAttackSpeedModifier(RANGED) * (1.0f + calcRating(CR_HASTE_RANGED) / 100.0f))));
15529 }
15530}
float getAttackSpeedModifier(WeaponDamageType type) const
Definition Unit.cpp:6930
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateAutoRepeatSpell()

void Player::updateAutoRepeatSpell ( )

Definition at line 4166 of file Player.cpp.

4167{
4168 // Get the autorepeat spell
4169 const auto autoRepeatSpell = getCurrentSpell(CURRENT_AUTOREPEAT_SPELL);
4170
4171 // If player is moving or casting a spell, interrupt wand casting and delay auto shot
4172 const auto isAutoShot = autoRepeatSpell->getSpellInfo()->getId() == 75;
4173 if (m_isMoving || isCastingSpell(false, true, isAutoShot))
4174 {
4175 if (!isAutoShot)
4176 {
4178 }
4179 m_FirstCastAutoRepeat = true;
4180 return;
4181 }
4182
4183 // Apply delay to wand shooting
4184 if (m_FirstCastAutoRepeat && (getAttackTimer(RANGED) - Util::getMSTime() < 500) && !isAutoShot)
4185 {
4186 setAttackTimer(RANGED, 500);
4187 }
4188 m_FirstCastAutoRepeat = false;
4189
4190 if (isAttackReady(RANGED))
4191 {
4192 const auto canCastAutoRepeatSpell = autoRepeatSpell->canCast(true, 0, 0);
4193 if (canCastAutoRepeatSpell != SPELL_CAST_SUCCESS)
4194 {
4195 if (!isAutoShot)
4197 else if (isPlayer())
4198 autoRepeatSpell->sendCastResult(canCastAutoRepeatSpell);
4199 return;
4200 }
4201
4202 // Cast the spell with triggered flag
4203 const auto newAutoRepeatSpell = sSpellMgr.newSpell(this, autoRepeatSpell->getSpellInfo(), true, nullptr);
4204 newAutoRepeatSpell->prepare(&autoRepeatSpell->m_targets);
4205
4207 }
4208}
@ SPELL_CAST_SUCCESS
bool m_FirstCastAutoRepeat
Definition Player.hpp:961
uint32_t getAttackTimer(WeaponDamageType type) const
Definition Unit.cpp:6907
Here is the call graph for this function:

◆ updateChanceFields()

void Player::updateChanceFields ( )

Definition at line 15496 of file Player.cpp.

15497{
15498#if VERSION_STRING != Classic
15499 for (uint8_t school = 0; school < 7; ++school)
15501#endif
15502}
float m_spellCritPercentage
Definition Unit.hpp:769
float m_spellCritChanceSchool[TOTAL_SPELL_SCHOOLS]
Definition Unit.hpp:1452
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateChances()

void Player::updateChances ( )

Definition at line 15401 of file Player.cpp.

15402{
15403 uint32_t playerClass = getClass();
15405
15406 float tmp = 0;
15407 float defence_contribution = 0;
15408
15409 // Avoidance from defense skill
15410 defence_contribution = getDefenseChance(playerLevel);
15411
15412 // Dodge
15413 tmp = getDodgeChance();
15414 tmp += defence_contribution;
15415 tmp = std::min(std::max(tmp, 0.0f), 95.0f);
15416 setDodgePercentage(tmp);
15417
15418 // Block
15420 if (it != nullptr && it->getItemProperties()->InventoryType == INVTYPE_SHIELD)
15421 {
15422 tmp = getBlockChance();
15423 tmp += defence_contribution;
15424 tmp = std::min(std::max(tmp, 0.0f), 95.0f);
15425 }
15426 else
15427 {
15428 tmp = 0.0f;
15429 }
15430
15431 setBlockPercentage(tmp);
15432
15433 // Parry (can only parry with something in main hand)
15435 if (it != nullptr)
15436 {
15437 tmp = getParryChance();
15438 tmp += defence_contribution;
15439 tmp = std::min(std::max(tmp, 0.0f), 95.0f);
15440 }
15441 else
15442 {
15443 tmp = 0.0f;
15444 }
15445
15446 setParryPercentage(tmp);
15447
15448 // Critical
15449 auto baseCrit = sGtChanceToMeleeCritBaseStore.lookupEntry(playerClass - 1);
15450
15451 auto CritPerAgi = sGtChanceToMeleeCritStore.lookupEntry(playerLevel - 1 + (playerClass - 1) * 100);
15452 if (CritPerAgi == nullptr)
15453 CritPerAgi = sGtChanceToMeleeCritStore.lookupEntry(DBC_PLAYER_LEVEL_CAP - 1 + (playerClass - 1) * 100);
15454
15455 tmp = 100 * (baseCrit->val + getStat(STAT_AGILITY) * CritPerAgi->val);
15456
15457 float melee_bonus = 0;
15458 float ranged_bonus = 0;
15459
15460 if (m_toCritChance.size() > 0)
15461 {
15464
15465 //-1 = any weapon
15466 for (std::map< uint32_t, WeaponModifier >::iterator itr = m_toCritChance.begin(); itr != m_toCritChance.end(); ++itr)
15467 {
15468 if (itr->second.wclass == (uint32_t)-1 || (tItemMelee != nullptr && (1 << tItemMelee->getItemProperties()->SubClass & itr->second.subclass)))
15469 melee_bonus += itr->second.value;
15470
15471 if (itr->second.wclass == (uint32_t)-1 || (tItemRanged != nullptr && (1 << tItemRanged->getItemProperties()->SubClass & itr->second.subclass)))
15472 ranged_bonus += itr->second.value;
15473 }
15474 }
15475
15476 float cr = tmp + calcRating(CR_CRIT_MELEE) + melee_bonus;
15477 setMeleeCritPercentage(std::min(cr, 95.0f));
15478
15479 float rcr = tmp + calcRating(CR_CRIT_RANGED) + ranged_bonus;
15480 setRangedCritPercentage(std::min(rcr, 95.0f));
15481
15482 auto SpellCritBase = sGtChanceToSpellCritBaseStore.lookupEntry(playerClass - 1);
15483
15484 auto SpellCritPerInt = sGtChanceToSpellCritStore.lookupEntry(playerLevel - 1 + (playerClass - 1) * 100);
15485 if (SpellCritPerInt == nullptr)
15486 SpellCritPerInt = sGtChanceToSpellCritStore.lookupEntry(DBC_PLAYER_LEVEL_CAP - 1 + (playerClass - 1) * 100);
15487
15488 m_spellCritPercentage = 100 * (SpellCritBase->val + getStat(STAT_INTELLECT) * SpellCritPerInt->val) +
15489 this->getSpellCritFromSpell() +
15491
15493}
#define DBC_PLAYER_LEVEL_CAP
SERVER_DECL WDB::WDBContainer< WDB::Structures::GtChanceToSpellCritBaseEntry > sGtChanceToSpellCritBaseStore
SERVER_DECL WDB::WDBContainer< WDB::Structures::GtChanceToSpellCritEntry > sGtChanceToSpellCritStore
float getDefenseChance(uint32_t opLevel)
Definition Player.cpp:15334
void updateChanceFields()
Definition Player.cpp:15496
float getSpellCritFromSpell()
Definition Player.hpp:2035
std::map< uint32_t, WeaponModifier > m_toCritChance
Definition Player.hpp:2094
float getBlockChance()
Definition Player.cpp:15383
float getDodgeChance()
Definition Player.cpp:15343
float getParryChance()
Definition Player.cpp:15392
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateChannels()

void Player::updateChannels ( )

Definition at line 7978 of file Player.cpp.

7979{
7981
7982#if VERSION_STRING < WotLK
7983 // TODO: verify if this is needed anymore in < wotlk
7984 // Correct zone for Hall of Legends
7985 if (GetMapId() == 450)
7987 // Correct zone for Champions' Hall
7988 else if (GetMapId() == 449)
7990#endif
7991
7992 // Update only default channels
7993 for (uint8_t i = 0; i < sChatChannelsStore.getNumRows(); ++i)
7994 {
7995 const auto channelDbc = sChatChannelsStore.lookupEntry(i);
7996 if (channelDbc == nullptr)
7997 continue;
7998
7999 Channel* oldChannel = nullptr;
8000
8001 m_mutexChannel.lock();
8002 for (auto _channel : m_channels)
8003 {
8004 if (_channel->getChannelId() == i)
8005 {
8006 // Found same channel
8007 oldChannel = _channel;
8008 break;
8009 }
8010 }
8011 m_mutexChannel.unlock();
8012
8013 if (sChannelMgr.canPlayerJoinDefaultChannel(this, areaEntry, channelDbc))
8014 {
8015 auto channelName = sChannelMgr.generateChannelName(channelDbc, areaEntry);
8016
8017 auto newChannel = sChannelMgr.getOrCreateChannel(channelName, this, channelDbc->id);
8018 if (newChannel == nullptr)
8019 {
8020 // should not happen
8021 sLogger.failure("Player::updateChannels : Could not create new channel {} with name {}", channelDbc->id, channelName);
8022 continue;
8023 }
8024
8025 if (newChannel != oldChannel && !newChannel->hasMember(this))
8026 {
8027 // Join new channel
8028 newChannel->attemptJoin(this, "", true);
8029 // Leave old channel if it exists
8030 if (oldChannel != nullptr)
8031 oldChannel->leaveChannel(this, false);
8032 }
8033 }
8034 else
8035 {
8036 // Leave old channel if it exists
8037 if (oldChannel != nullptr)
8038 oldChannel->leaveChannel(this);
8039 }
8040 }
8041}
#define sChannelMgr
SERVER_DECL WDB::WDBContainer< WDB::Structures::ChatChannelsEntry > sChatChannelsStore
Definition WDBStores.cpp:61
void attemptJoin(Player *plr, std::string password, bool skipCheck=false)
Definition Channel.cpp:85
void leaveChannel(Player *plr, bool sendPacket=true)
Definition Channel.cpp:138
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateComboPoints()

void Player::updateComboPoints ( )

Definition at line 5387 of file Player.cpp.

5388{
5389 if (getComboPoints() > 5)
5390 m_comboPoints = 5;
5391
5392 if (getComboPoints() < 0)
5393 m_comboPoints = 0;
5394
5395 // todo: I think there should be a better way to do this, copypasting from legacy method now -Appled
5396 unsigned char buffer[10];
5397 uint16_t length = 2;
5398
5399 if (getComboPointTarget() != 0)
5400 {
5401 const auto* const target = getWorldMapUnit(getComboPointTarget());
5402 if (target == nullptr || target->isDead() || getTargetGuid() != getComboPointTarget())
5403 {
5404 buffer[0] = buffer[1] = 0;
5405 }
5406 else
5407 {
5408 length = static_cast<uint16_t>(FastGUIDPack(getComboPointTarget(), buffer, 0));
5410 }
5411 }
5412 else
5413 {
5414 buffer[0] = buffer[1] = 0;
5415 }
5416
5418}
@ SMSG_UPDATE_COMBO_POINTS
Definition Opcodes.hpp:1007
static void FastGUIDPack(ByteBuffer &buf, const uint64_t &oldguid)
int8_t getComboPoints() const
Definition Player.cpp:5361
float length(float v)
Definition vectorMath.h:208
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateHonor()

void Player::updateHonor ( )

Definition at line 8162 of file Player.cpp.

8163{
8164#if VERSION_STRING != Classic
8165 this->setFieldKills((this->m_killsToday | this->m_killsYesterday << 16));
8166#if VERSION_STRING < Cata
8167 this->setContributionToday(this->m_honorToday);
8168 this->setContributionYesterday(this->m_honorYesterday);
8169
8170 this->setHonorCurrency(this->m_honorPoints);
8171#endif
8172#endif
8174
8175 this->updateKnownCurrencies(43308, true);
8176}
void setLifetimeHonorableKills(uint32_t kills)
Definition Player.cpp:1264
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateInrangeSetsBasedOnReputation()

void Player::updateInrangeSetsBasedOnReputation ( )

Definition at line 11610 of file Player.cpp.

11611{
11612 for (const auto& object : getInRangeObjectsSet())
11613 {
11614 if (!object->isCreatureOrPlayer())
11615 continue;
11616
11617 if (const auto unit = dynamic_cast<Unit*>(object))
11618 {
11619 if (unit->m_factionEntry == nullptr || unit->m_factionEntry->RepListId < 0)
11620 continue;
11621
11622 bool isHostile = isHostileBasedOnReputation(unit->m_factionEntry);
11623 bool currentHostileObject = isObjectInInRangeOppositeFactionSet(unit);
11624
11625 if (isHostile && !currentHostileObject)
11627 else if (!isHostile && currentHostileObject)
11629 }
11630 }
11631}
bool isObjectInInRangeOppositeFactionSet(Object *pObj) const
Definition Object.cpp:1633
void addInRangeOppositeFaction(Object *obj)
Definition Object.cpp:1673
bool isHostileBasedOnReputation(WDB::Structures::FactionEntry const *factionEntry)
Definition Player.cpp:11591
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateKnownCurrencies()

void Player::updateKnownCurrencies ( uint32_t  itemId,
bool  apply 
)

Definition at line 13232 of file Player.cpp.

13233{
13234#if VERSION_STRING == WotLK
13235 if (auto const* currency_type_entry = sCurrencyTypesStore.lookupEntry(itemId))
13236 {
13237 if (apply)
13238 {
13239 uint64_t oldval = getKnownCurrencies();
13240 uint64_t newval = oldval | (1LL << (currency_type_entry->bit_index - 1));
13241 setKnownCurrencies(newval);
13242 }
13243 else
13244 {
13245 uint64_t oldval = getKnownCurrencies();
13246 uint64_t newval = oldval & ~(1LL << (currency_type_entry->bit_index - 1));
13247 setKnownCurrencies(newval);
13248 }
13249 }
13250#else
13251 if (itemId == 0 || apply) { return; }
13252#endif
13253}
SERVER_DECL WDB::WDBContainer< WDB::Structures::CurrencyTypesEntry > sCurrencyTypesStore
void setKnownCurrencies(uint64_t currencies)
Definition Player.cpp:990
uint64_t getKnownCurrencies() const
Definition Player.cpp:989
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateManaRegeneration()

void Player::updateManaRegeneration ( bool  initialUpdate = false)

Definition at line 13 of file PlayerStats.cpp.

14{
15 // Used by all versions
16 const auto spirit = getStat(STAT_SPIRIT);
17
18#if VERSION_STRING == Classic
19 // Calculations are based on Nostalrius' work
20 float_t regenerateValue = 0.0f;
21 switch (getClass())
22 {
23 case PALADIN:
24 case HUNTER:
25 case WARLOCK:
26 case DRUID:
27 regenerateValue = spirit / 5 + 15.0f;
28 break;
29 case PRIEST:
30 case MAGE:
31 regenerateValue = spirit / 4 + 12.5f;
32 break;
33 case SHAMAN:
34 regenerateValue = spirit / 5 + 17.0f;
35 break;
36 default:
37 break;
38 }
39
41
42 // This is per 5 seconds
44 for (uint8_t i = 0; i < STAT_COUNT; ++i)
45 mp5 += (m_modManaRegenFromStat[i] * getStat(i)) / 500.0f;
46
47 auto manaWhileCastingPct = m_modInterrManaRegenPct;
48 // Cap at 100%
49 if (manaWhileCastingPct > 100)
50 manaWhileCastingPct = 100;
51
52 // Make sure mana regeneration isn't negative
53 if (regenerateValue < 0)
54 regenerateValue = 0.0f;
55 if (mp5 < 0)
56 mp5 = 0.0f;
57
58 const auto manaRegen = std::ceil((mp5 + regenerateValue) * worldConfig.getFloatRate(RATE_POWER1));
59 const auto manaRegenCast = std::ceil((mp5 + (regenerateValue * manaWhileCastingPct / 100.0f)) * worldConfig.getFloatRate(RATE_POWER1));
62#else
63 // Patch 2.2.0: "Any effect which triggers a change in your rate of power regeneration (Mana, Rage, Energy, Focus)
64 // will now cause an immediate reward of some power at the old rate of increase, and then begin new "ticks" of power at the new rate approximately 2 seconds later.
65 // This was done to improve functionality of abilities such as Evocation and Innervate so that they did not have wasted "ticks"."
66 if (!initialUpdate && isAlive())
68
69 auto playerLevel = getLevel();
70 if (playerLevel > DBC_STAT_LEVEL_CAP)
71 playerLevel = DBC_STAT_LEVEL_CAP;
72
73 // Get base mana regeneration value from DBC
74 const auto index = (getClass() - 1) * DBC_STAT_LEVEL_CAP + playerLevel - 1;
75 const auto manaPerSpiritDBC = sGtRegenMPPerSptStore.lookupEntry(index);
76 //\ todo: gtOCTRegenMP.dbc seems to have base mana regen values for all classes (i.e 0.25 for paladin 1-80lvl on wotlk)
77 //\ how is it used in calculations?
78 //const auto baseManaRegen = sGtOCTRegenMPStore.lookupEntry(index);
79
80 float_t baseRegen = 0.0f;
81 if (manaPerSpiritDBC != nullptr)
82 baseRegen = manaPerSpiritDBC->ratio;
83
84#if VERSION_STRING == TBC || VERSION_STRING == WotLK
85 const auto intellect = getStat(STAT_INTELLECT);
86 // From wowwiki: MP5 = 5 * (0.001 + std::sqrt(Int) * Spirit * Base_Regen) * 0.60 rounded up
87 float_t regenerateValue = 0.001f + std::sqrt(static_cast<float_t>(intellect)) * spirit * baseRegen;
89
90 // This is per 5 seconds
92 for (uint8_t i = 0; i < STAT_COUNT; ++i)
93 mp5 += (m_modManaRegenFromStat[i] * getStat(i)) / 500.0f;
94
95 auto manaWhileCastingPct = m_modInterrManaRegenPct;
96 // Cap at 100%
97 if (manaWhileCastingPct > 100)
98 manaWhileCastingPct = 100;
99
100 // Make sure mana regeneration isn't negative
101 if (regenerateValue < 0)
102 regenerateValue = 0.0f;
103 if (mp5 < 0)
104 mp5 = 0.0f;
105
106 const auto manaRegen = std::ceil((mp5 + regenerateValue) * worldConfig.getFloatRate(RATE_POWER1));
107 const auto manaRegenCast = std::ceil((mp5 + (regenerateValue * manaWhileCastingPct / 100.0f)) * worldConfig.getFloatRate(RATE_POWER1));
110#elif VERSION_STRING == Cata
111 const auto intellect = getStat(STAT_INTELLECT);
112 // From wowwiki: MP5 = 5 * (0.001 + std::sqrt(Int) * Spirit * Base_Regen) * 0.60 rounded up
113 float_t regenerateValue = 0.001f + std::sqrt(static_cast<float_t>(intellect)) * spirit * baseRegen;
115
116 // In cata 5 second rule no longer exists
117 // Instead you regen 5% of your base mana without modifiers while in combat
119 baseCombatRegen /= 5.0f;
120
121 auto manaWhileInCombatPct = m_modInterrManaRegenPct;
122 // Cap at 100%
123 if (manaWhileInCombatPct > 100)
124 manaWhileInCombatPct = 100;
125
126 const auto manaRegen = std::ceil((regenerateValue + baseCombatRegen) * worldConfig.getFloatRate(RATE_POWER1));
127 const auto manaRegenCombat = std::ceil((baseCombatRegen + (regenerateValue * manaWhileInCombatPct / 100.0f)) * worldConfig.getFloatRate(RATE_POWER1));
130#elif VERSION_STRING == Mop
131 // In MOP base combat mana regen is 2% of player's total mana
132 float_t baseCombatRegen = getMaxPower(POWER_TYPE_MANA) * 0.02f;
133
134 // Combat Regen = Total Mana * 0.02 + (1.1287 * SPI * Meditation%)
137
138 auto manaWhileInCombatPct = m_modInterrManaRegenPct;
139 // Cap at 100%
140 if (manaWhileInCombatPct > 100)
141 manaWhileInCombatPct = 100;
142
143 const auto manaRegen = std::ceil((regenerateValue + baseCombatRegen) * worldConfig.getFloatRate(RATE_POWER1));
144 const auto manaRegenCombat = std::ceil((baseCombatRegen + (regenerateValue * manaWhileInCombatPct / 100.0f)) * worldConfig.getFloatRate(RATE_POWER1));
147#endif
148#endif
149}
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
SERVER_DECL WDB::WDBContainer< WDB::Structures::GtRegenMPPerSptEntry > sGtRegenMPPerSptStore
@ RATE_POWER1
Definition WorldConfig.h:15
uint32_t m_modInterrManaRegenPct
Definition Player.hpp:2064
int32_t m_modManaRegenFromStat[STAT_COUNT]
Definition Player.hpp:2066
void setPowerRegenerationWhileInterrupted(PowerType type, float value)
Definition Unit.cpp:887
void setPowerRegeneration(PowerType type, float value)
Definition Unit.cpp:794
float_t getTotalFloatDamageForAuraEffectByMiscValue(AuraEffect aura_effect, int32_t miscValue) const
Definition Unit.cpp:4982
void _regeneratePowersAtRegenUpdate(PowerType type)
Definition Unit.cpp:6761
float_t getTotalPctMultiplierForAuraEffectByMiscValue(AuraEffect aura_effect, int32_t miscValue) const
Definition Unit.cpp:4999
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateNearbyQuestGameObjects()

void Player::updateNearbyQuestGameObjects ( )

Definition at line 9043 of file Player.cpp.

9044{
9045 for (const auto& itr : getInRangeObjectsSet())
9046 {
9047 auto* obj = itr;
9048 if (obj == nullptr || !obj->isGameObject() || obj->isTransporter())
9049 continue;
9050
9051 if (const auto gameobject = dynamic_cast<GameObject*>(obj))
9052 {
9053 const auto gobProperties = gameobject->GetGameObjectProperties();
9054
9055 // Update dynamic flags for gameobjects with quests or item loot
9056 if (gameobject->isQuestGiver() || !gobProperties->itemMap.empty() || !gobProperties->goMap.empty())
9057 {
9058#if VERSION_STRING < Mop
9059 gameobject->forceBuildUpdateValueForField(getOffsetForStructuredField(WoWGameObject, dynamic), this);
9060#else
9061 gameobject->forceBuildUpdateValueForField(getOffsetForStructuredField(WoWObject, dynamic_field), this);
9062#endif
9063 }
9064 }
9065 }
9066}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePotionCooldown()

void Player::updatePotionCooldown ( )

Definition at line 4532 of file Player.cpp.

4533{
4535 return;
4536
4537 if (const auto itemProperties = sMySQLStore.getItemProperties(m_lastPotionId))
4538 {
4539 for (uint8_t spellIndex = 0; spellIndex < MAX_ITEM_PROTO_SPELLS; ++spellIndex)
4540 {
4541 if (itemProperties->Spells[spellIndex].Id != 0 && itemProperties->Spells[spellIndex].Trigger == USE)
4542 {
4543 if (const auto* const spellInfo = sSpellMgr.getSpellInfo(itemProperties->Spells[spellIndex].Id))
4544 {
4545 cooldownAddItem(itemProperties, spellIndex);
4546 sendSpellCooldownEventPacket(spellInfo->getId());
4547 }
4548 }
4549 }
4550 }
4551
4552 m_lastPotionId = 0;
4553}
@ USE
#define MAX_ITEM_PROTO_SPELLS
void sendSpellCooldownEventPacket(uint32_t spellId)
Definition Player.cpp:9676
void cooldownAddItem(ItemProperties const *itemProp, uint32_t spellIndex)
Definition Player.cpp:4478
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePvPArea()

void Player::updatePvPArea ( )

Definition at line 8231 of file Player.cpp.

8232{
8233 auto areaTableEntry = this->GetArea();
8234 if (areaTableEntry == nullptr)
8235 return;
8236
8238 {
8239 if (isPvpFlagSet())
8240 removePvpFlag();
8241 else
8242 stopPvPTimer();
8243
8245 return;
8246 }
8247
8248 if ((areaTableEntry->team == AREAC_ALLIANCE_TERRITORY && isTeamAlliance()) || (areaTableEntry->team == AREAC_HORDE_TERRITORY && isTeamHorde()))
8249 {
8251 resetPvPTimer();
8252 }
8253 else
8254 {
8255 if (areaTableEntry->flags & AREA_CITY_AREA || areaTableEntry->flags & AREA_CITY)
8256 {
8257 if ((areaTableEntry->team == AREAC_ALLIANCE_TERRITORY && isTeamHorde()) || (areaTableEntry->team == AREAC_HORDE_TERRITORY && isTeamAlliance()))
8258 {
8259 if (!isPvpFlagSet())
8260 setPvpFlag();
8261 else
8262 stopPvPTimer();
8263 return;
8264 }
8265 }
8266
8267 if (areaTableEntry->zone)
8268 {
8269 if (auto at2 = AreaStorage::GetAreaById(areaTableEntry->zone))
8270 {
8271 if ((at2->team == AREAC_ALLIANCE_TERRITORY && isTeamAlliance()) || (at2->team == AREAC_HORDE_TERRITORY && isTeamHorde()))
8272 {
8274 resetPvPTimer();
8275
8276 return;
8277 }
8278
8279 if (at2->flags & AREA_CITY_AREA || at2->flags & AREA_CITY)
8280 {
8281 if ((at2->team == AREAC_ALLIANCE_TERRITORY && isTeamHorde()) || (at2->team == AREAC_HORDE_TERRITORY && isTeamAlliance()))
8282 {
8283 if (!isPvpFlagSet())
8284 setPvpFlag();
8285 else
8286 stopPvPTimer();
8287 return;
8288 }
8289 }
8290 }
8291 }
8292
8293 if (areaTableEntry->team == AREAC_SANCTUARY || areaTableEntry->flags & AREA_SANCTUARY)
8294 {
8295 if (isPvpFlagSet())
8296 removePvpFlag();
8297 else
8298 stopPvPTimer();
8299
8302 }
8303 else
8304 {
8306
8307 if (sLogonCommHandler.getRealmType() == REALMTYPE_PVP || sLogonCommHandler.getRealmType() == REALMTYPE_RPPVP)
8308 {
8309 if (!isPvpFlagSet())
8310 setPvpFlag();
8311 else
8312 stopPvPTimer();
8313 }
8314
8315 if (sLogonCommHandler.getRealmType() == REALMTYPE_NORMAL || sLogonCommHandler.getRealmType() == REALMTYPE_RP)
8316 {
8318 {
8319 if (!isPvpFlagSet())
8320 setPvpFlag();
8321 }
8323 {
8324 resetPvPTimer();
8325 }
8326 }
8327
8328 if (areaTableEntry->flags & AREA_PVP_ARENA)
8329 {
8330 if (!isPvpFlagSet())
8331 setPvpFlag();
8332
8333 setFfaPvpFlag();
8334 }
8335 else
8336 {
8338 }
8339 }
8340 }
8341}
void removeSanctuaryFlag() override
Definition Player.cpp:9874
void removeFfaPvpFlag() override
Definition Player.cpp:9840
void setFfaPvpFlag() override
Definition Player.cpp:9828
void setSanctuaryFlag() override
Definition Player.cpp:9863
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePvPCurrencies()

void Player::updatePvPCurrencies ( )

Definition at line 8509 of file Player.cpp.

8510{
8511 this->updateHonor();
8512 this->updateArenaPoints();
8513}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateRageRegeneration()

void Player::updateRageRegeneration ( bool  initialUpdate = false)

Definition at line 151 of file PlayerStats.cpp.

152{
153#if VERSION_STRING >= TBC
154 // Patch 2.2.0: "Any effect which triggers a change in your rate of power regeneration (Mana, Rage, Energy, Focus)
155 // will now cause an immediate reward of some power at the old rate of increase, and then begin new "ticks" of power at the new rate approximately 2 seconds later.
156 // This was done to improve functionality of abilities such as Evocation and Innervate so that they did not have wasted "ticks"."
157 if (!initialUpdate && isAlive())
159#endif
160
161 // Base out of combat decay is 1.25 rage per second
162 float_t outCombat = -12.5f;
163 float_t inCombat = 0.0f;
164
165 // Flat values are per 5 seconds
167 outCombat += flatAmount;
168 inCombat += flatAmount;
169 // There dont seem to be any rage percent modifers
170 // Apply config rate to combat regeneration only
171 inCombat *= worldConfig.getFloatRate(RATE_POWER2);
172 // Remove base out of combat decay
173 outCombat -= -12.5f;
174
177}
@ RATE_POWER2
Definition WorldConfig.h:16
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateRestState()

void Player::updateRestState ( )

Definition at line 12262 of file Player.cpp.

12263{
12264 if (m_restAmount && getLevel() < getMaxLevel())
12266 else
12268
12271}
void setRestStateXp(uint32_t xp)
Definition Player.cpp:1173
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateRunicPowerRegeneration()

void Player::updateRunicPowerRegeneration ( bool  initialUpdate = false)

Definition at line 180 of file PlayerStats.cpp.

181{
182 // Patch 2.2.0: "Any effect which triggers a change in your rate of power regeneration (Mana, Rage, Energy, Focus)
183 // will now cause an immediate reward of some power at the old rate of increase, and then begin new "ticks" of power at the new rate approximately 2 seconds later.
184 // This was done to improve functionality of abilities such as Evocation and Innervate so that they did not have wasted "ticks"."
185 if (!initialUpdate && isAlive())
187
188 // There dont seem to be any out of combat modifiers
189 float_t inCombat = 0.0f;
190 // Flat Values are per 5 seconds (Butchery talent only increases combat regeneration)
192 // There dont seem to be any runic power percent modifers
193 // Apply config rate to combat regeneration only
194 inCombat *= worldConfig.getFloatRate(RATE_POWER7);
195
198}
@ RATE_POWER7
Definition WorldConfig.h:21
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateSkillMaximumValues()

void Player::updateSkillMaximumValues ( )

Definition at line 5168 of file Player.cpp.

5169{
5170 for (auto& itr : m_skills)
5171 {
5172 // Skip initialized only values
5173 if (itr.second.CurrentValue == 0)
5174 continue;
5175
5176 auto valuesChanged = false;
5177 uint16_t skillStep = 0;
5178
5179 _verifySkillValues(itr.second.Skill, &itr.second.CurrentValue, &itr.second.MaximumValue, &skillStep, &valuesChanged);
5180
5181 // Update skill fields
5182#if VERSION_STRING < Cata
5183 if (valuesChanged)
5184#else
5185 if (valuesChanged && itr.second.Skill->type != SKILL_TYPE_WEAPON)
5186#endif
5187 _updateSkillFieldOnValueChange(itr.second.FieldPosition, skillStep, itr.second.CurrentValue, itr.second.MaximumValue);
5188 }
5189}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateStats()

void Player::updateStats ( )

Definition at line 15532 of file Player.cpp.

15533{
15535
15536 // Formulas from wowwiki
15537 int32_t attackPower = 0;
15538 int32_t rangedAttackPower = 0;
15539 int32_t hpdelta = 128;
15540 int32_t manadelta = 128;
15541
15544 uint32_t lev = getLevel();
15545
15546 // Attack power
15547 uint32_t playerClass = getClass();
15548 switch (playerClass)
15549 {
15550 case DRUID:
15551 //(Strength x 2) - 20
15552 attackPower = str * 2 - 20;
15553 //Agility - 10
15554 rangedAttackPower = agi - 10;
15555
15557 {
15558 //(Strength x 2) + (Character Level x 1.5) - 20
15559 attackPower += Util::float2int32(static_cast<float>(lev) * 1.5f);
15560 }
15561 if (getShapeShiftForm() == FORM_CAT)
15562 {
15563 //(Strength x 2) + Agility + (Character Level x 2) - 20
15564 attackPower += agi + (lev * 2);
15565 }
15567 {
15568 //(Strength x 2) + (Character Level x 3) - 20
15569 attackPower += (lev * 3);
15570 }
15571 break;
15572
15573 case ROGUE:
15574 //Strength + Agility + (Character Level x 2) - 20
15575 attackPower = str + agi + (lev * 2) - 20;
15576 //Character Level + Agility - 10
15577 rangedAttackPower = lev + agi - 10;
15578
15579 break;
15580
15581 case HUNTER:
15582 //Strength + Agility + (Character Level x 2) - 20
15583 attackPower = str + agi + (lev * 2) - 20;
15584 //(Character Level x 2) + Agility - 10
15585 rangedAttackPower = (lev * 2) + agi - 10;
15586
15587 break;
15588
15589 case SHAMAN:
15590 //(Strength) + (Agility) + (Character Level x 2) - 20
15591 attackPower = str + agi + (lev * 2) - 20;
15592 //Agility - 10
15593 rangedAttackPower = agi - 10;
15594
15595 break;
15596
15597 case PALADIN:
15598 //(Strength x 2) + (Character Level x 3) - 20
15599 attackPower = (str * 2) + (lev * 3) - 20;
15600 //Agility - 10
15601 rangedAttackPower = agi - 10;
15602
15603 break;
15604
15605 case WARRIOR:
15606#if VERSION_STRING >= WotLK
15607 case DEATHKNIGHT:
15608 //(Strength x 2) + (Character Level x 3) - 20
15609 attackPower = (str * 2) + (lev * 3) - 20;
15610 //Character Level + Agility - 10
15611 rangedAttackPower = lev + agi - 10;
15612
15613 break;
15614#endif
15615 default: //mage,priest,warlock
15616 attackPower = agi - 10;
15617 }
15618
15619 /* modifiers */
15620 rangedAttackPower += m_rapModPct * getStat(STAT_INTELLECT) / 100;
15621
15622 if (rangedAttackPower < 0)
15623 rangedAttackPower = 0;
15624
15625 if (attackPower < 0)
15626 attackPower = 0;
15627
15628 setAttackPower(attackPower);
15629 setRangedAttackPower(rangedAttackPower);
15630
15631 const auto* levelInfo = sObjectMgr.getLevelInfo(this->getRace(), this->getClass(), lev);
15632 if (levelInfo != nullptr)
15633 {
15634 hpdelta = levelInfo->Stat[2] * 10;
15635 manadelta = levelInfo->Stat[3] * 15;
15636 }
15637
15638 levelInfo = sObjectMgr.getLevelInfo(this->getRace(), this->getClass(), 1);
15639 if (levelInfo != nullptr)
15640 {
15641 hpdelta -= levelInfo->Stat[2] * 10;
15642 manadelta -= levelInfo->Stat[3] * 15;
15643 }
15644
15645 uint32_t hp = getBaseHealth();
15646
15647#if VERSION_STRING != Classic
15648 int32_t stat_bonus = getPosStat(STAT_STAMINA) - getNegStat(STAT_STAMINA);
15649#else
15650 int32_t stat_bonus = 0;
15651#endif
15652 if (stat_bonus < 0)
15653 stat_bonus = 0; // Avoid of having negative health
15654 int32_t bonus = stat_bonus * 10 + m_healthFromSpell + m_healthFromItems;
15655
15656 uint32_t res = hp + bonus + hpdelta;
15657 uint32_t oldmaxhp = getMaxHealth();
15658
15659 if (res < hp)
15660 res = hp;
15661
15662 if (worldConfig.limit.isLimitSystemEnabled && (worldConfig.limit.maxHealthCap > 0) && (res > worldConfig.limit.maxHealthCap) && !getSession()->hasPermissions()) //hacker?
15663 {
15664 std::stringstream dmgLog;
15665 dmgLog << "has over " << worldConfig.limit.maxArenaPoints << " health " << res;
15666
15667 sCheatLog.writefromsession(getSession(), dmgLog.str().c_str());
15668
15669 if (worldConfig.limit.broadcastMessageToGmOnExceeding)
15670 sendReportToGmMessage(getName(), dmgLog.str());
15671
15672 if (worldConfig.limit.disconnectPlayerForExceedingLimits)
15674 else // no disconnect, set it to the cap instead
15675 res = worldConfig.limit.maxHealthCap;
15676 }
15677 setMaxHealth(res);
15678
15679 if (getHealth() > res)
15680 {
15681 setHealth(res);
15682 }
15683 else if (playerClass == DRUID && (getShapeShiftForm() == FORM_BEAR || getShapeShiftForm() == FORM_DIREBEAR))
15684 {
15685 res = getMaxHealth() * getHealth() / oldmaxhp;
15686 setHealth(res);
15687 }
15688
15689 if (playerClass != WARRIOR && playerClass != ROGUE
15690#if VERSION_STRING > TBC
15691 && playerClass != DEATHKNIGHT
15692#endif
15693 )
15694 {
15695 // MP
15696 uint32_t mana = getBaseMana();
15697#if VERSION_STRING != Classic
15698 stat_bonus = getPosStat(STAT_INTELLECT) - getNegStat(STAT_INTELLECT);
15699#endif
15700 if (stat_bonus < 0)
15701 stat_bonus = 0; // Avoid of having negative mana
15702 bonus = stat_bonus * 15 + m_manaFromSpell + m_manaFromItems;
15703
15704 res = mana + bonus + manadelta;
15705 if (res < mana)
15706 res = mana;
15707
15708 if (worldConfig.limit.isLimitSystemEnabled && (worldConfig.limit.maxManaCap > 0) && (res > worldConfig.limit.maxManaCap) && !getSession()->hasPermissions()) //hacker?
15709 {
15710 char logmsg[256];
15711 snprintf(logmsg, 256, "has over %u mana (%i)", worldConfig.limit.maxManaCap, res);
15712 sCheatLog.writefromsession(getSession(), logmsg);
15713
15714 if (worldConfig.limit.broadcastMessageToGmOnExceeding) // send m_playerCreateInfo to online GM
15715 sendReportToGmMessage(getName(), logmsg);
15716
15717 if (worldConfig.limit.disconnectPlayerForExceedingLimits)
15719 else // no disconnect, set it to the cap instead
15720 res = worldConfig.limit.maxManaCap;
15721 }
15723
15724 if (getPower(POWER_TYPE_MANA) > res)
15726
15728 }
15729
15730 // Spell haste rating
15731 float haste = 1.0f + calcRating(CR_HASTE_SPELL) / 100.0f;
15732 if (haste != m_spellHasteRatingBonus)
15733 {
15734 float value = getModCastSpeed() * m_spellHasteRatingBonus / haste; // remove previous mod and apply current
15735
15737 m_spellHasteRatingBonus = haste; // keep value for next run
15738 }
15739
15740 // Shield Block
15742 if (itemShield != nullptr && itemShield->getItemProperties()->InventoryType == INVTYPE_SHIELD)
15743 {
15744 float block_multiplier = (100.0f + m_modBlockAbsorbValue) / 100.0f;
15745 if (block_multiplier < 1.0f)
15746 block_multiplier = 1.0f;
15747
15748 int32_t blockable_damage = Util::float2int32((itemShield->getItemProperties()->Block + m_modBlockValueFromSpells + getCombatRating(CR_BLOCK) + (str / 2.0f) - 1.0f) * block_multiplier);
15749#if VERSION_STRING != Classic
15750 setShieldBlock(blockable_damage);
15751#endif
15752 }
15753 else
15754 {
15755#if VERSION_STRING != Classic
15756 setShieldBlock(0);
15757#endif
15758 }
15759
15760 // Dynamic aura application, auras 212, 268
15761#if VERSION_STRING >= WotLK
15763 aurEff->getAura()->updateModifiers();
15764#endif
15765#if VERSION_STRING >= TBC
15767 aurEff->getAura()->updateModifiers();
15768
15769 updateChances();
15770#endif
15771
15773}
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_BY_STAT_PCT
@ SPELL_AURA_MOD_ATTACK_POWER_BY_STAT_PCT
void calculateDamage() override
Definition Player.cpp:16612
int32_t m_rapModPct
Definition Player.hpp:2182
void updateAttackSpeed()
Definition Player.cpp:15504
uint32_t m_modBlockValueFromSpells
Definition Player.hpp:2049
float m_spellHasteRatingBonus
Definition Player.hpp:2021
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zoneUpdate()

void Player::zoneUpdate ( uint32_t  zoneId)

Definition at line 2097 of file Player.cpp.

2098{
2099 uint32_t oldzone = m_zoneId;
2100 if (m_zoneId != zoneId)
2101 {
2102 setZoneId(zoneId);
2104 }
2105
2106 if (m_playerInfo)
2107 {
2108 m_playerInfo->lastZone = zoneId;
2109 sHookInterface.OnZone(this, zoneId, oldzone);
2110
2112 m_WorldMap->getScript()->OnZoneChange(this, zoneId, oldzone);
2113
2114 auto at = GetArea();
2115 if (at && (at->team == AREAC_SANCTUARY || at->flags & AREA_SANCTUARY))
2116 {
2117 Unit* pUnit = (getTargetGuid() == 0) ? nullptr : (m_WorldMap ? m_WorldMap->getUnit(getTargetGuid()) : nullptr);
2118 if (pUnit && m_duelPlayer != pUnit)
2119 {
2121 smsg_AttackStop(pUnit);
2122 }
2123
2124 if (isCastingSpell())
2125 {
2126 for (uint8_t i = 0; i < CURRENT_SPELL_MAX; ++i)
2127 {
2128 if (getCurrentSpell(CurrentSpellType(i)) != nullptr)
2129 {
2131 if (target != nullptr && target != m_duelPlayer && target != this)
2132 {
2134 }
2135 }
2136 }
2137 }
2138 }
2139
2141
2143 }
2144 else
2145 {
2146 sLogger.failure("Player with invalid player_info tries to call Player::zoneUpdate()!");
2148 }
2149}
@ AURA_INTERRUPT_ON_LEAVE_AREA
void updateChannels()
Definition Player.cpp:7978
Unit * getUnitTarget() const
Definition Spell.cpp:5682
Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ Pet

friend class Pet
friend

Definition at line 105 of file Player.hpp.

◆ WorldSession

friend class WorldSession
friend

Definition at line 104 of file Player.hpp.

Member Data Documentation

◆ _fields

uint32_t Player::_fields[getSizeOfStructure(WoWPlayer)]
protected

Definition at line 2225 of file Player.hpp.

◆ afkReason

std::string Player::afkReason
private

Definition at line 1119 of file Player.hpp.

◆ armorProficiency

uint32_t Player::armorProficiency = 0
private

Definition at line 981 of file Player.hpp.

◆ m_aiInterfaceWaypoint

AIInterface* Player::m_aiInterfaceWaypoint = nullptr

Definition at line 1094 of file Player.hpp.

◆ m_areaSpiritHealerGuid

uint64_t Player::m_areaSpiritHealerGuid = 0
private

Definition at line 1223 of file Player.hpp.

◆ m_arenaPoints

uint32_t Player::m_arenaPoints = 0
private

Definition at line 1358 of file Player.hpp.

◆ m_arenaTeams

std::array<ArenaTeam*, NUM_ARENA_TEAM_TYPES> Player::m_arenaTeams = { nullptr }
private

Definition at line 1357 of file Player.hpp.

1357{ nullptr };

◆ m_attacking

bool Player::m_attacking = false
protected

Definition at line 2209 of file Player.hpp.

◆ m_AttackMsgTimer

uint32_t Player::m_AttackMsgTimer = 0
protected

Definition at line 2208 of file Player.hpp.

◆ m_avengingWrath

bool Player::m_avengingWrath = true

Definition at line 2248 of file Player.hpp.

◆ m_banned

uint32_t Player::m_banned = 0
private

Definition at line 1106 of file Player.hpp.

◆ m_banreason

std::string Player::m_banreason
private

Definition at line 1107 of file Player.hpp.

◆ m_baseResistanceModPctNeg

uint32_t Player::m_baseResistanceModPctNeg[TOTAL_SPELL_SCHOOLS] = { 0 }

Definition at line 2054 of file Player.hpp.

2054{ 0 };

◆ m_baseResistanceModPctPos

uint32_t Player::m_baseResistanceModPctPos[TOTAL_SPELL_SCHOOLS] = { 0 }

Definition at line 2053 of file Player.hpp.

2053{ 0 };

◆ m_battlegroundLastPetId

uint8_t Player::m_battlegroundLastPetId = 0
private

Definition at line 1805 of file Player.hpp.

◆ m_battlegroundLastPetSpell

uint32_t Player::m_battlegroundLastPetSpell = 0
private

Definition at line 1806 of file Player.hpp.

◆ m_beingPushed

bool Player::m_beingPushed = false

Definition at line 2175 of file Player.hpp.

◆ m_bg

Battleground* Player::m_bg = nullptr
private

Definition at line 1455 of file Player.hpp.

◆ m_bgEntryData

BGEntryData Player::m_bgEntryData
private

Definition at line 1261 of file Player.hpp.

◆ m_bgHasFlag

bool Player::m_bgHasFlag = false
private

Definition at line 1466 of file Player.hpp.

◆ m_bgQueueType

uint32_t Player::m_bgQueueType = 0
private

Definition at line 1464 of file Player.hpp.

◆ m_bgScore

BGScore Player::m_bgScore

Definition at line 1452 of file Player.hpp.

◆ m_bgTeam

uint32_t Player::m_bgTeam = 0
private

Definition at line 740 of file Player.hpp.

◆ m_bindData

BindData Player::m_bindData
private

Definition at line 1243 of file Player.hpp.

◆ m_blinked

bool Player::m_blinked = false

Definition at line 2174 of file Player.hpp.

◆ m_blockFromSpellPct

float Player::m_blockFromSpellPct = 0.0f
protected

Definition at line 2212 of file Player.hpp.

◆ m_boundInstances

Definition at line 2126 of file Player.hpp.

◆ m_cachedPets

PetCacheMap Player::m_cachedPets
private

Definition at line 1801 of file Player.hpp.

◆ m_cachedPetSlots

std::map<uint8_t, uint8_t> Player::m_cachedPetSlots
private

Definition at line 1803 of file Player.hpp.

◆ m_canDualWield2H

bool Player::m_canDualWield2H = false
private

Definition at line 972 of file Player.hpp.

◆ m_cannibalize

bool Player::m_cannibalize = false

Definition at line 2095 of file Player.hpp.

◆ m_cannibalizeCount

uint8_t Player::m_cannibalizeCount = 0

Definition at line 2096 of file Player.hpp.

◆ m_castedAmount

uint32_t Player::m_castedAmount[TOTAL_SPELL_SCHOOLS] = { 0 }

Definition at line 2068 of file Player.hpp.

2068{ 0 }; // Last casted spells amounts. Need for some spells. Like Ignite etc. DOesn't count HoTs and DoTs. Only directs

◆ m_championingFactionId

uint32_t Player::m_championingFactionId = 0
private

Definition at line 1694 of file Player.hpp.

◆ m_changingMaps

bool Player::m_changingMaps = true

Definition at line 2179 of file Player.hpp.

◆ m_channels

std::set<Channel*> Player::m_channels
private

Definition at line 1336 of file Player.hpp.

◆ m_charters

std::array<Charter*, NUM_CHARTER_TYPES> Player::m_charters = { nullptr }
private

Definition at line 1273 of file Player.hpp.

1273{ nullptr };

◆ m_cheats

PlayerCheat Player::m_cheats = {false}

Definition at line 1090 of file Player.hpp.

1090{false};

◆ m_classicMaxLevel

uint32_t Player::m_classicMaxLevel = 60
private

Definition at line 733 of file Player.hpp.

◆ m_comboPoints

int8_t Player::m_comboPoints = 0
private

Definition at line 985 of file Player.hpp.

◆ m_comboTarget

uint64_t Player::m_comboTarget = 0
private

Definition at line 984 of file Player.hpp.

◆ m_cooldownMap

PlayerCooldownMap Player::m_cooldownMap[NUM_COOLDOWN_TYPES]
protected

Definition at line 917 of file Player.hpp.

◆ m_corpseData

CorpseData Player::m_corpseData
private

Definition at line 1212 of file Player.hpp.

◆ m_critFromSpell

float Player::m_critFromSpell = 0.0f
protected

Definition at line 2213 of file Player.hpp.

◆ m_currentLoot

uint64_t Player::m_currentLoot = 0
private

Definition at line 1649 of file Player.hpp.

◆ m_damageDone

std::map<uint32_t, WeaponModifier> Player::m_damageDone

Definition at line 2093 of file Player.hpp.

◆ m_dbcClass

WDB::Structures::ChrClassesEntry const* Player::m_dbcClass = nullptr
private

Definition at line 728 of file Player.hpp.

◆ m_dbcRace

WDB::Structures::ChrRacesEntry const* Player::m_dbcRace = nullptr
private

Definition at line 727 of file Player.hpp.

◆ m_deathVision

bool Player::m_deathVision = false

Definition at line 2184 of file Player.hpp.

◆ m_deletedSpellSet

SpellSet Player::m_deletedSpellSet
private

Definition at line 969 of file Player.hpp.

◆ m_detectedRange

int32_t Player::m_detectedRange = 0

Definition at line 2079 of file Player.hpp.

◆ m_disableAppearing

bool Player::m_disableAppearing = false
private

Definition at line 1101 of file Player.hpp.

◆ m_disableSummoning

bool Player::m_disableSummoning = false
private

Definition at line 1102 of file Player.hpp.

◆ m_drunkTimer

uint32_t Player::m_drunkTimer = 0
private

Definition at line 1705 of file Player.hpp.

◆ m_duelCountdownTimer

uint32_t Player::m_duelCountdownTimer = 0
private

Definition at line 1729 of file Player.hpp.

◆ m_duelPlayer

Player* Player::m_duelPlayer = nullptr
private

Definition at line 1726 of file Player.hpp.

◆ m_duelState

uint8_t Player::m_duelState = DUEL_STATE_FINISHED
private

Definition at line 1728 of file Player.hpp.

◆ m_duelStatus

uint8_t Player::m_duelStatus = 0
private

Definition at line 1727 of file Player.hpp.

◆ m_dungeonDifficulty

uint8_t Player::m_dungeonDifficulty = 0
private

Definition at line 1168 of file Player.hpp.

◆ m_enteringWorld

bool Player::m_enteringWorld = false
private

Definition at line 785 of file Player.hpp.

◆ m_explorationTimer

uint32_t Player::m_explorationTimer

Definition at line 649 of file Player.hpp.

◆ m_fallDisabledUntil

time_t Player::m_fallDisabledUntil = 0
protected

Definition at line 635 of file Player.hpp.

◆ m_finishedDailies

std::set<uint32_t> Player::m_finishedDailies = {}
private

Definition at line 1524 of file Player.hpp.

1524{};

◆ m_finishedQuests

std::set<uint32_t> Player::m_finishedQuests = {}
private

Definition at line 1527 of file Player.hpp.

1527{};

◆ m_finishingMovesDodge

bool Player::m_finishingMovesDodge = false

Definition at line 2189 of file Player.hpp.

◆ m_FirstCastAutoRepeat

bool Player::m_FirstCastAutoRepeat = false

Definition at line 961 of file Player.hpp.

◆ m_firstLogin

bool Player::m_firstLogin = false

Definition at line 1982 of file Player.hpp.

◆ m_FirstTalentTreeLock

uint32_t Player::m_FirstTalentTreeLock = 0

Definition at line 1990 of file Player.hpp.

◆ m_flatResistanceModifierNeg

uint32_t Player::m_flatResistanceModifierNeg[TOTAL_SPELL_SCHOOLS] = { 0 }

Definition at line 2052 of file Player.hpp.

2052{ 0 };

◆ m_flatResistanceModifierPos

uint32_t Player::m_flatResistanceModifierPos[TOTAL_SPELL_SCHOOLS] = { 0 }

Definition at line 2051 of file Player.hpp.

2051{ 0 };

◆ m_flatStatModNeg

uint32_t Player::m_flatStatModNeg[5] = { 0 }

Definition at line 2071 of file Player.hpp.

2071{ 0 };

◆ m_flatStatModPos

uint32_t Player::m_flatStatModPos[5] = { 0 }

Definition at line 2070 of file Player.hpp.

2070{ 0 };

◆ m_flyingAura

uint32_t Player::m_flyingAura = 0

Definition at line 2177 of file Player.hpp.

◆ m_foodDrinkSpellVisualTimer

uint16_t Player::m_foodDrinkSpellVisualTimer = 5000
private

Definition at line 833 of file Player.hpp.

◆ m_forcedReactions

std::map<uint32_t, Standing> Player::m_forcedReactions

Definition at line 2228 of file Player.hpp.

◆ m_formationMaster

Creature* Player::m_formationMaster = nullptr

Definition at line 1098 of file Player.hpp.

◆ m_GarbageItems

std::list<std::unique_ptr<Item> > Player::m_GarbageItems
private

Definition at line 1151 of file Player.hpp.

◆ m_globalCooldown

uint32_t Player::m_globalCooldown = 0
protected

Definition at line 918 of file Player.hpp.

◆ m_gmPlayerTargetList

std::vector<uint32_t> Player::m_gmPlayerTargetList
private

Definition at line 1121 of file Player.hpp.

◆ m_GMSelectedGO

uint64_t Player::m_GMSelectedGO = 0
private

Definition at line 1104 of file Player.hpp.

◆ m_goLastXRotation

float Player::m_goLastXRotation = 0.0f

Definition at line 1091 of file Player.hpp.

◆ m_goLastYRotation

float Player::m_goLastYRotation = 0.0f

Definition at line 1092 of file Player.hpp.

◆ m_grouIdpInviterId

uint32_t Player::m_grouIdpInviterId = 0
private

Definition at line 1318 of file Player.hpp.

◆ m_groupUpdateFlags

uint32_t Player::m_groupUpdateFlags
private

Definition at line 1324 of file Player.hpp.

◆ m_hasBindDialogOpen

bool Player::m_hasBindDialogOpen = false

Definition at line 1234 of file Player.hpp.

◆ m_hasWonRbgToday

bool Player::m_hasWonRbgToday = false
private

Definition at line 1462 of file Player.hpp.

◆ m_healthFromItems

uint32_t Player::m_healthFromItems = 0
protected

Definition at line 2219 of file Player.hpp.

◆ m_healthFromSpell

uint32_t Player::m_healthFromSpell = 0
protected

Definition at line 2217 of file Player.hpp.

◆ m_hearthOfWildPct

int Player::m_hearthOfWildPct = 0
protected

Definition at line 1962 of file Player.hpp.

◆ m_hitFromSpell

float Player::m_hitFromSpell = 0.0f
protected

Definition at line 2215 of file Player.hpp.

◆ m_holyPowerRegenerateTimer

uint16_t Player::m_holyPowerRegenerateTimer = 0
private

Definition at line 829 of file Player.hpp.

◆ m_honorless

uint32_t Player::m_honorless = 0
private

Definition at line 1390 of file Player.hpp.

◆ m_honorPoints

uint32_t Player::m_honorPoints = 0
private

Definition at line 1383 of file Player.hpp.

◆ m_honorRolloverTime

uint32_t Player::m_honorRolloverTime = 0
private

Definition at line 1385 of file Player.hpp.

◆ m_honorToday

uint32_t Player::m_honorToday = 0
private

Definition at line 1388 of file Player.hpp.

◆ m_honorYesterday

uint32_t Player::m_honorYesterday = 0
private

Definition at line 1389 of file Player.hpp.

◆ m_increaseCricticalByTypePct

float Player::m_increaseCricticalByTypePct[12] = { 0 }

Definition at line 2078 of file Player.hpp.

2078{ 0 };

◆ m_increaseDamageByType

int32_t Player::m_increaseDamageByType[12] = { 0 }

Definition at line 2076 of file Player.hpp.

2076{ 0 }; // mod dmg by creature type

◆ m_increaseDamageByTypePct

float Player::m_increaseDamageByTypePct[12] = { 0 }

Definition at line 2077 of file Player.hpp.

2077{ 0 };

◆ m_increaseDmgSnaredSlowed

uint32_t Player::m_increaseDmgSnaredSlowed = 0

Definition at line 2061 of file Player.hpp.

◆ m_indoorCheckTimer

uint32_t Player::m_indoorCheckTimer = 0
protected

Definition at line 633 of file Player.hpp.

◆ m_instanceResetTimes

InstanceTimeMap Player::m_instanceResetTimes

Definition at line 2153 of file Player.hpp.

◆ m_inviteArenaTeamId

uint32_t Player::m_inviteArenaTeamId = 0
private

Definition at line 1359 of file Player.hpp.

◆ m_invitedByGuildId

uint32_t Player::m_invitedByGuildId = 0
private

Definition at line 1287 of file Player.hpp.

◆ m_isCorpseCreationAllowed

bool Player::m_isCorpseCreationAllowed = true
private

Definition at line 1214 of file Player.hpp.

◆ m_isGmInvisible

bool Player::m_isGmInvisible = false

Definition at line 1096 of file Player.hpp.

◆ m_isJumping

bool Player::m_isJumping = false
protected

Definition at line 622 of file Player.hpp.

◆ m_isMoving

bool Player::m_isMoving = false
protected

Definition at line 618 of file Player.hpp.

◆ m_isMovingFB

bool Player::m_isMovingFB = false
protected

Definition at line 619 of file Player.hpp.

◆ m_isQueuedForBg

bool Player::m_isQueuedForBg = false
private

Definition at line 1458 of file Player.hpp.

◆ m_isQueuedForRbg

bool Player::m_isQueuedForRbg = false
private

Definition at line 1461 of file Player.hpp.

◆ m_isReadyToBeRemoved

bool Player::m_isReadyToBeRemoved = false

Definition at line 123 of file Player.hpp.

◆ m_isResting

uint8_t Player::m_isResting = 0
private

Definition at line 1749 of file Player.hpp.

◆ m_isStrafing

bool Player::m_isStrafing = false
protected

Definition at line 620 of file Player.hpp.

◆ m_isTurning

bool Player::m_isTurning = false
protected

Definition at line 621 of file Player.hpp.

◆ m_isWaterBreathingEnabled

bool Player::m_isWaterBreathingEnabled = false

Definition at line 582 of file Player.hpp.

◆ m_isXpGainAllowed

bool Player::m_isXpGainAllowed = true
private

Definition at line 1747 of file Player.hpp.

◆ m_itemInterface

std::unique_ptr<ItemInterface> Player::m_itemInterface
private

Definition at line 1148 of file Player.hpp.

◆ m_itemSets

std::list<ItemSet> Player::m_itemSets
protected

Definition at line 1154 of file Player.hpp.

◆ m_itemUpdateTimer

uint32_t Player::m_itemUpdateTimer = 0
private

Definition at line 1916 of file Player.hpp.

◆ m_kickDelay

uint32_t Player::m_kickDelay = 0
private

Definition at line 1108 of file Player.hpp.

◆ m_killsLifetime

uint32_t Player::m_killsLifetime = 0
private

Definition at line 1393 of file Player.hpp.

◆ m_killsToday

uint32_t Player::m_killsToday = 0
private

Definition at line 1392 of file Player.hpp.

◆ m_killsYesterday

uint32_t Player::m_killsYesterday = 0
private

Definition at line 1394 of file Player.hpp.

◆ m_lastGroupPosition

LocationVector Player::m_lastGroupPosition
private

Definition at line 1322 of file Player.hpp.

◆ m_lastHealSpell

SpellInfo const* Player::m_lastHealSpell = nullptr

Definition at line 2186 of file Player.hpp.

◆ m_lastHonorResetTime

uint32_t Player::m_lastHonorResetTime = 0
private

Definition at line 1386 of file Player.hpp.

◆ m_lastPotionId

uint32_t Player::m_lastPotionId = 0
protected

Definition at line 916 of file Player.hpp.

◆ m_lastSeenWeather

uint32_t Player::m_lastSeenWeather = 0

Definition at line 2115 of file Player.hpp.

◆ m_levelInfo

LevelInfo const* Player::m_levelInfo = nullptr
private

Definition at line 725 of file Player.hpp.

◆ m_lifeTapBonus

int Player::m_lifeTapBonus = 0

Definition at line 2042 of file Player.hpp.

◆ m_loadHealth

uint32_t Player::m_loadHealth = 0
private

Definition at line 730 of file Player.hpp.

◆ m_loadMana

uint32_t Player::m_loadMana = 0
private

Definition at line 731 of file Player.hpp.

◆ m_lockGMTargetList

std::mutex Player::m_lockGMTargetList
mutableprivate

Definition at line 1122 of file Player.hpp.

◆ m_loginAuras

std::list<LoginAura> Player::m_loginAuras
protected

Definition at line 1964 of file Player.hpp.

◆ m_loginFlag

uint32_t Player::m_loginFlag = LOGIN_NO_FLAG
private

Definition at line 737 of file Player.hpp.

◆ m_lootableOnCorpse

bool Player::m_lootableOnCorpse = false
private

Definition at line 1650 of file Player.hpp.

◆ m_lootGuid

uint64_t Player::m_lootGuid = 0
private

Definition at line 1648 of file Player.hpp.

◆ m_mailBox

std::unique_ptr<Mailbox> Player::m_mailBox

Definition at line 2188 of file Player.hpp.

◆ m_manaFromItems

uint32_t Player::m_manaFromItems = 0
protected

Definition at line 2220 of file Player.hpp.

◆ m_manaFromSpell

uint32_t Player::m_manaFromSpell = 0
protected

Definition at line 2218 of file Player.hpp.

◆ m_maxPetNumber

uint8_t Player::m_maxPetNumber = 0
private

Definition at line 1809 of file Player.hpp.

◆ m_maxTalentPoints

uint16_t Player::m_maxTalentPoints = 0

Definition at line 1986 of file Player.hpp.

◆ m_misdirectionTarget

uint64_t Player::m_misdirectionTarget = 0

Definition at line 2086 of file Player.hpp.

◆ m_modBlockAbsorbValue

uint32_t Player::m_modBlockAbsorbValue = 0

Definition at line 2048 of file Player.hpp.

◆ m_modBlockValueFromSpells

uint32_t Player::m_modBlockValueFromSpells = 0

Definition at line 2049 of file Player.hpp.

◆ m_modInterrManaRegenPct

uint32_t Player::m_modInterrManaRegenPct = 0

Definition at line 2064 of file Player.hpp.

◆ m_modManaRegenFromStat

int32_t Player::m_modManaRegenFromStat[STAT_COUNT] = { 0 }

Definition at line 2066 of file Player.hpp.

2066{ 0 };

◆ m_modPhysCritDmgPct

uint32_t Player::m_modPhysCritDmgPct = 0

Definition at line 2059 of file Player.hpp.

◆ m_mountSpellId

uint32_t Player::m_mountSpellId = 0
protected

Definition at line 624 of file Player.hpp.

◆ m_mountVehicleId

uint32_t Player::m_mountVehicleId = 0
protected

Definition at line 625 of file Player.hpp.

◆ m_mutexChannel

std::mutex Player::m_mutexChannel
mutableprivate

Definition at line 1337 of file Player.hpp.

◆ m_mutexFriendedBy

std::mutex Player::m_mutexFriendedBy
mutableprivate

Definition at line 1563 of file Player.hpp.

◆ m_mutexFriendList

std::mutex Player::m_mutexFriendList
mutableprivate

Definition at line 1560 of file Player.hpp.

◆ m_mutexIgnoreList

std::mutex Player::m_mutexIgnoreList
mutableprivate

Definition at line 1566 of file Player.hpp.

◆ m_mutextDailies

std::mutex Player::m_mutextDailies
mutableprivate

Definition at line 1523 of file Player.hpp.

◆ m_name

utf8_string Player::m_name
private

Definition at line 735 of file Player.hpp.

◆ m_nextSave

uint32_t Player::m_nextSave

Definition at line 2040 of file Player.hpp.

◆ m_noseLevel

float Player::m_noseLevel = .0f
protected

Definition at line 627 of file Player.hpp.

◆ m_offhandDmgMod

float Player::m_offhandDmgMod = 0.5f

Definition at line 1937 of file Player.hpp.

◆ m_onlineTime

uint32_t Player::m_onlineTime = static_cast<uint32_t>(UNIXTIME)
private

Definition at line 744 of file Player.hpp.

◆ m_outStealthDamageBonusPct

uint32_t Player::m_outStealthDamageBonusPct = 0

Definition at line 2233 of file Player.hpp.

◆ m_outStealthDamageBonusPeriod

uint32_t Player::m_outStealthDamageBonusPeriod = 0

Definition at line 2234 of file Player.hpp.

◆ m_outStealthDamageBonusTimer

uint32_t Player::m_outStealthDamageBonusTimer = 0

Definition at line 2235 of file Player.hpp.

◆ m_partyUpdateTimer

uint16_t Player::m_partyUpdateTimer = 1000
private

Definition at line 1915 of file Player.hpp.

◆ m_passOnLoot

bool Player::m_passOnLoot = false

Definition at line 2230 of file Player.hpp.

◆ m_pctReputationMod

int32_t Player::m_pctReputationMod = 0
private

Definition at line 1691 of file Player.hpp.

◆ m_pendingBattleground

Battleground* Player::m_pendingBattleground = nullptr
private

Definition at line 1456 of file Player.hpp.

◆ m_pendingBindId

uint32_t Player::m_pendingBindId = 0
private

Definition at line 2156 of file Player.hpp.

◆ m_pendingBindTimer

uint32_t Player::m_pendingBindTimer = 0
private

Definition at line 2157 of file Player.hpp.

◆ m_pendingPacketTimer

uint16_t Player::m_pendingPacketTimer = 100
private

Definition at line 1914 of file Player.hpp.

◆ m_petSpells

std::map<uint32_t, std::map<SpellInfo const*, uint16_t>*> Player::m_petSpells

Definition at line 2164 of file Player.hpp.

◆ m_playedTime

uint32_t Player::m_playedTime[3] = { 0, 0, static_cast<uint32_t>(UNIXTIME) }
private

Definition at line 743 of file Player.hpp.

743{ 0, 0, static_cast<uint32_t>(UNIXTIME) };

◆ m_playerCreateInfo

PlayerCreateInfo const* Player::m_playerCreateInfo = nullptr
protected

Definition at line 750 of file Player.hpp.

◆ m_playerInfo

CachedCharacterInfo* Player::m_playerInfo = nullptr
private

Definition at line 747 of file Player.hpp.

◆ m_pvpTimer

uint32_t Player::m_pvpTimer = 0
private

Definition at line 1412 of file Player.hpp.

◆ m_questlog

std::array<std::unique_ptr<QuestLogEntry>, MAX_QUEST_LOG_SIZE> Player::m_questlog
private

Definition at line 1521 of file Player.hpp.

◆ m_questSharer

uint32_t Player::m_questSharer = 0
private

Definition at line 1528 of file Player.hpp.

◆ m_queuedBgInstanceId

uint32_t Player::m_queuedBgInstanceId = 0
private

Definition at line 1459 of file Player.hpp.

◆ m_rageFromDamageDealt

int32_t Player::m_rageFromDamageDealt = 0

Definition at line 2097 of file Player.hpp.

◆ m_rageFromDamageTaken

int32_t Player::m_rageFromDamageTaken = 0

Definition at line 2098 of file Player.hpp.

◆ m_raidDifficulty

uint8_t Player::m_raidDifficulty = 0
private

Definition at line 1169 of file Player.hpp.

◆ m_rapModPct

int32_t Player::m_rapModPct = 0

Definition at line 2182 of file Player.hpp.

◆ m_RegenManaOnSpellResist

float Player::m_RegenManaOnSpellResist = 0.0f

Definition at line 2067 of file Player.hpp.

◆ m_reincarnation

bool Player::m_reincarnation = false

Definition at line 2091 of file Player.hpp.

◆ m_removequests

std::set<uint32_t> Player::m_removequests = {}
private

Definition at line 1526 of file Player.hpp.

1526{};

◆ m_reputation

ReputationMap Player::m_reputation
private

Definition at line 1690 of file Player.hpp.

◆ m_reputationByListId

FactionReputation* Player::m_reputationByListId[128] = { nullptr }
private

Definition at line 1692 of file Player.hpp.

1692{ nullptr };

◆ m_requiresNoAmmo

bool Player::m_requiresNoAmmo = false

Definition at line 2043 of file Player.hpp.

◆ m_resendSpeed

bool Player::m_resendSpeed = false

Definition at line 2180 of file Player.hpp.

◆ m_resetTalents

bool Player::m_resetTalents = false
private

Definition at line 1013 of file Player.hpp.

◆ m_resistanceModPctNeg

uint32_t Player::m_resistanceModPctNeg[TOTAL_SPELL_SCHOOLS] = { 0 }

Definition at line 2056 of file Player.hpp.

2056{ 0 };

◆ m_resistanceModPctPos

uint32_t Player::m_resistanceModPctPos[TOTAL_SPELL_SCHOOLS] = { 0 }

Definition at line 2055 of file Player.hpp.

2055{ 0 };

◆ m_resistCritical

float Player::m_resistCritical[2] = { 0 }

Definition at line 891 of file Player.hpp.

891{ 0 }; // when we are a victim we can have talents to decrease chance for critical hit. This is a negative value and it's added to critchances

◆ m_resistHit

float Player::m_resistHit[2] = { 0 }

Definition at line 2057 of file Player.hpp.

2057{ 0 }; // 0 = melee; 1= ranged;

◆ m_resistHitSpell

int32_t Player::m_resistHitSpell[TOTAL_SPELL_SCHOOLS] = { 0 }

Definition at line 2058 of file Player.hpp.

2058{ 0 }; // spell resist per school

◆ m_restAmount

uint32_t Player::m_restAmount = 0
private

Definition at line 1751 of file Player.hpp.

◆ m_restState

uint8_t Player::m_restState = 0
private

Definition at line 1750 of file Player.hpp.

◆ m_resurrecter

uint64_t Player::m_resurrecter = 0
private

Definition at line 1216 of file Player.hpp.

◆ m_resurrectHealth

uint32_t Player::m_resurrectHealth = 0
private

Definition at line 1217 of file Player.hpp.

◆ m_resurrectInstanceID

uint32_t Player::m_resurrectInstanceID = 0
private

Definition at line 1219 of file Player.hpp.

◆ m_resurrectMana

uint32_t Player::m_resurrectMana = 0
private

Definition at line 1218 of file Player.hpp.

◆ m_resurrectMapId

uint32_t Player::m_resurrectMapId = 0
private

Definition at line 1220 of file Player.hpp.

◆ m_resurrectPosition

LocationVector Player::m_resurrectPosition = { 0, 0, 0, 0 }
private

Definition at line 1221 of file Player.hpp.

1221{ 0, 0, 0, 0 };

◆ m_retaineDrage

uint32_t Player::m_retaineDrage = 0

Definition at line 2080 of file Player.hpp.

◆ m_roles

uint8_t Player::m_roles = 0
private

Definition at line 1468 of file Player.hpp.

◆ m_rootedCritChanceBonus

uint32_t Player::m_rootedCritChanceBonus = 0

Definition at line 2060 of file Player.hpp.

◆ m_sendOnlyRaidgroup

bool Player::m_sendOnlyRaidgroup = false
private

Definition at line 1320 of file Player.hpp.

◆ m_sentTeleportPosition

LocationVector Player::m_sentTeleportPosition
protected

Definition at line 629 of file Player.hpp.

◆ m_serversideDrunkValue

uint16_t Player::m_serversideDrunkValue = 0
private

Definition at line 1706 of file Player.hpp.

◆ m_session

WorldSession* Player::m_session = nullptr
protected

Definition at line 788 of file Player.hpp.

◆ m_shapeshiftSpells

SpellSet Player::m_shapeshiftSpells
private

Definition at line 970 of file Player.hpp.

◆ m_skills

SkillMap Player::m_skills
private

Definition at line 979 of file Player.hpp.

◆ m_socialFriendedByGuids

std::vector<uint32_t> Player::m_socialFriendedByGuids = {}
private

Definition at line 1562 of file Player.hpp.

1562{};

◆ m_socialIFriends

std::vector<SocialFriends> Player::m_socialIFriends = {}
private

Definition at line 1559 of file Player.hpp.

1559{};

◆ m_socialIgnoring

std::vector<uint32_t> Player::m_socialIgnoring = {}
private

Definition at line 1565 of file Player.hpp.

1565{};

◆ m_spec

PlayerSpec Player::m_spec

Definition at line 1996 of file Player.hpp.

◆ m_speedCheatDetector

std::unique_ptr<SpeedCheatDetector> Player::m_speedCheatDetector
private

Definition at line 1575 of file Player.hpp.

◆ m_spellAreaUpdateTimer

uint16_t Player::m_spellAreaUpdateTimer = 1000
private

Definition at line 1913 of file Player.hpp.

◆ m_spellCritFromSpell

float Player::m_spellCritFromSpell = 0.0f
protected

Definition at line 2214 of file Player.hpp.

◆ m_spellHasteRatingBonus

float Player::m_spellHasteRatingBonus = 1.0f

Definition at line 2021 of file Player.hpp.

◆ m_spellOverrideMap

SpellOverrideMap Player::m_spellOverrideMap

Definition at line 868 of file Player.hpp.

◆ m_spellSet

SpellSet Player::m_spellSet
private

Definition at line 968 of file Player.hpp.

◆ m_stableSlotCount

uint8_t Player::m_stableSlotCount = 0
private

Definition at line 1808 of file Player.hpp.

◆ m_statModPctNeg

uint32_t Player::m_statModPctNeg[5] = { 0 }

Definition at line 2073 of file Player.hpp.

2073{ 0 };

◆ m_statModPctPos

uint32_t Player::m_statModPctPos[5] = { 0 }

Definition at line 2072 of file Player.hpp.

2072{ 0 };

◆ m_summonData

SummonData Player::m_summonData
private

Definition at line 1117 of file Player.hpp.

◆ m_summonedObject

Object* Player::m_summonedObject = nullptr
private

Definition at line 1811 of file Player.hpp.

◆ m_summonSpells

std::map<uint32_t, std::set<uint32_t> > Player::m_summonSpells

Definition at line 2163 of file Player.hpp.

◆ m_talentActiveSpec

uint8_t Player::m_talentActiveSpec = 0

Definition at line 1988 of file Player.hpp.

◆ m_talentPointsFromQuests

uint32_t Player::m_talentPointsFromQuests = 0
private

Definition at line 1011 of file Player.hpp.

◆ m_talentResetsCount

uint32_t Player::m_talentResetsCount = 0
private

Definition at line 1012 of file Player.hpp.

◆ m_talentSpecsCount

uint8_t Player::m_talentSpecsCount = 1

Definition at line 1987 of file Player.hpp.

◆ m_targetIcon

uint8_t Player::m_targetIcon = 0
protected

Definition at line 2223 of file Player.hpp.

◆ m_taxi

std::unique_ptr<TaxiPath> Player::m_taxi
private

Definition at line 1629 of file Player.hpp.

◆ m_team

uint32_t Player::m_team = 0
private

Definition at line 739 of file Player.hpp.

◆ m_teleportState

uint32_t Player::m_teleportState = 1
protected

Definition at line 631 of file Player.hpp.

◆ m_timeLogoff

uint32_t Player::m_timeLogoff = 0
private

Definition at line 745 of file Player.hpp.

◆ m_timeSyncClient

uint32_t Player::m_timeSyncClient = 0
private

Definition at line 1924 of file Player.hpp.

◆ m_timeSyncCounter

uint32_t Player::m_timeSyncCounter = 0
private

Definition at line 1922 of file Player.hpp.

◆ m_timeSyncServer

uint32_t Player::m_timeSyncServer = 0
private

Definition at line 1925 of file Player.hpp.

◆ m_timeSyncTimer

uint32_t Player::m_timeSyncTimer = 0
private

Definition at line 1923 of file Player.hpp.

◆ m_toCritChance

std::map<uint32_t, WeaponModifier> Player::m_toCritChance

Definition at line 2094 of file Player.hpp.

◆ m_totalStatModPctNeg

uint32_t Player::m_totalStatModPctNeg[5] = { 0 }

Definition at line 2075 of file Player.hpp.

2075{ 0 };

◆ m_totalStatModPctPos

uint32_t Player::m_totalStatModPctPos[5] = { 0 }

Definition at line 2074 of file Player.hpp.

2074{ 0 };

◆ m_trackingSpell

uint32_t Player::m_trackingSpell = 0

Definition at line 2104 of file Player.hpp.

◆ m_TradeData

std::unique_ptr<TradeData> Player::m_TradeData
private

Definition at line 1050 of file Player.hpp.

◆ m_tradeMutex

std::mutex Player::m_tradeMutex
private

Definition at line 1052 of file Player.hpp.

◆ m_tradeSequence

uint32_t Player::m_tradeSequence

Definition at line 2231 of file Player.hpp.

◆ m_transferStatus

uint8_t Player::m_transferStatus = TRANSFER_NONE
protected

Definition at line 630 of file Player.hpp.

◆ m_tutorials

uint32_t Player::m_tutorials[8] = {0}
protected

Definition at line 1025 of file Player.hpp.

1025{0};

◆ m_tutorialsDirty

bool Player::m_tutorialsDirty = true
protected

Definition at line 1026 of file Player.hpp.

◆ m_underwaterLastDamage

uint32_t Player::m_underwaterLastDamage

Definition at line 586 of file Player.hpp.

◆ m_underwaterMaxTime

uint32_t Player::m_underwaterMaxTime = 180000

Definition at line 584 of file Player.hpp.

◆ m_underwaterState

uint32_t Player::m_underwaterState = 0

Definition at line 585 of file Player.hpp.

◆ m_underwaterTime

uint32_t Player::m_underwaterTime = 180000

Definition at line 583 of file Player.hpp.

◆ m_updateMgr

UpdateManager Player::m_updateMgr
private

Definition at line 783 of file Player.hpp.

◆ m_visibleFarsightObjects

std::set<Object*> Player::m_visibleFarsightObjects

Definition at line 2116 of file Player.hpp.

◆ m_visibleObjects

std::set<uint64_t> Player::m_visibleObjects
protected

Definition at line 803 of file Player.hpp.

◆ m_visibleUpdateMask

UpdateMask Player::m_visibleUpdateMask
static

Definition at line 772 of file Player.hpp.

◆ m_wratings

std::map<uint32_t, uint32_t> Player::m_wratings

Definition at line 1932 of file Player.hpp.

◆ quest_mobs

std::set<uint32_t> Player::quest_mobs = {}
private

Definition at line 1530 of file Player.hpp.

1530{};

◆ quest_spells

std::set<uint32_t> Player::quest_spells = {}
private

Definition at line 1529 of file Player.hpp.

1529{};

◆ weaponProficiency

uint32_t Player::weaponProficiency = 0
private

Definition at line 982 of file Player.hpp.


The documentation for this class was generated from the following files: